What approaches has anyone found that would allow for
parsing of serverside events when using the
Page.ParseControl method? I currently have the following
snippet in an xsl file:
Login:<br/>
<asp:TextBox ID="userid" Runat="server" /><br/>
<asp:LinkButton ID="login" Runat="server"
OnServerClick="Login_Click" />
When I use the ParseControl method to parse it and add
this to the Page Controls Collection, it works fine, with
the exception of not including the OnServerClick as the
handler for this click event. It is sent to the client.
I have read an article which uses server-side code to look
for specific controls and manually add the event handlers
to each control. I do not know up front what the controls
are called, and which events would fire which handlers, so
this is not really possible to do in the code. Is there a
better or different way to do this?
Andy Smith - 01 Oct 2003 19:42 GMT
After the control is parsed, you would presumably have
access to the Attributes collection. From there, you could
cycle thru them, and pick out the ones that start
with "on". Then you could use reflection to see if that
control type has an event named the same. if it does, then
use a bit more reflection to look for the appropriate
method to connect with.
__
Andy Smith
>-----Original Message-----
>What approaches has anyone found that would allow for
[quoted text clipped - 19 lines]
>better or different way to do this?
>.