c# - __doPostBack not being included as part of control -


i have been scratching head on 1 few hours , issue seems interesting. seem missing __dopostback event should come control not. have suggested adding:

clientscript.getpostbackeventreference(this, string.empty); 

this however, while create function definition looking for, no matter page reloads on postback event. have mentioned in:

__dopostback not defined

this because control id not match/not found.

i doing wrong considering 1) postback function not render without being brute forced in 2) when brute forced in, postback cannot find appropriate setup. here snippets of code:

class definition

[parsechildren(true)] [persistchildren(true)] [toolboxdata("<{0}:accordion runat=server></{0}:accordion>")] public class accordion : databoundcontrol, ipostbackeventhandler 

events

public event jqui_event itemclick; 

click handler, raisepostbackevent, , onload appends __dopostback

    public void raisepostbackevent(string eventargument)     {         itemclick(null, null);     }      protected override void onload(eventargs e)     {         page.clientscript.getpostbackeventreference(this, string.empty);         base.onload(e);     }      protected virtual void onclick(eventargs e)     {         if (itemclick != null)         {             itemclick(null, null);         }     } 

finally code generates the postback:

        if (itemclick != null)         {             output += "<script> $(function() { $('#" + clientid + "').find('div').on('click', function() { __dopostback('" + uniqueid + "', '') }); }); </script>";         }         writer.write(output); 

let me know if need more code. didn't want throw long page of code , tell people figure out.

edit:

ok, got raisepostbackevent(string eventargument) called. however, issue having page still decides reload. have tested make sure calls correct function in correct control (not because it's postback). there way limit partial postback rather full postback?

see getpostbackeventreference documentation, shows returns string, contains __dopostback method call. it's not registration method control. render string control. __dopostback not automatic output when using custom controls.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -