c# - RadAjaxManager in a user control with at most one such manager per page -


it known error if try add radajaxmanager page twice:

only 1 instance of radajaxmanager can added page

telerik explains how can solve design-time issues proxy control.

for of controls use on pages, error not fire, though each of these controls have radajaxmanager on them, inside repeater (accidentally, still, error doesn't throw). however, 1 such control (a dynamic button) have added several places on page no problem, possibly because same control, nested in control receive error above again, add page.

i have tried solve by:

  • adding control dynamically page, because control events fire before page events, leads dynamic behavior not occur anymore.
  • adding radajaxmanager dynamically once control, built-in checks, so:

    private radajaxmanager getajaxmanager() {     var ctl = this.findcontrol("ajaxmanager");     if (ctl != null)     {         return (radajaxmanager)ctl;     }      // alternative method     var mgr = radajaxmanager.getcurrent(this.page);     if (mgr != null)     {         return mgr;     }      // control never found, returns null     return null; }  protected override void oninit(eventargs e) {     if (this.getajaxmanager() == null)     {         // ajax mgr never found, , throws         // "cannot add multiple times" error         var ajaxmanager = new radajaxmanager();         ajaxmanager.id = "ajaxmanager";         this.controls.add(ajaxmanager);     } } 
    • several variants of above

the result either: control never found , therefore added more once, resulting in above error, or control added late in process other controls in usercontrol, resulting in several ajax events not happening.

how should add radajaxmanager user-control used inside several other user-controls, such manager occurs once on page and/or such radajaxmanager.getcurrent works?

plane - add radajaxmanager page level, not user controls. thus, user controls can have radajaxmanagerproxy controls, static getcurrent() method work.

plan b - use radajaxpanel controls if want self-contained user controls. have ajaxrequest() client-side method , server side event that, , since user controls smallish, able away single panel them.

plan c - leave ajax setup parent page. if parent user control ajax-enabled, entire content travel postback, neesting more ajax settings on inner user controls may not bring performance benefit.

plan d - use asp:updatepanel controls updatemode=conditional have extremely fine-grained control of partial rendering.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -