Click here to Skip to main content
15,891,900 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,


I am dynamically creating controls in user controls page.
Now, I want to create dynamic events to those controls which I have created dynamically.
Posted
Comments
Sunasara Imdadhusen 22-Nov-10 6:40am    
How can giving you a answer without any code??

Have a look here[^].
 
Share this answer
 
First of all in User control add events for all the controls
like in .ascx Page
XML
<asp:Button id="btnSample" runat="server" onClick="btnSample_Click" Text="Test"></asp:Button>

in .ascx.cs page
C#
private void btnSample_Click(object sender, EventArgs e)
{
}

After that just register that user control in the required .aspx page and in that .cs page just register the perticular event as per user control.
 
Share this answer
 
v2
Comments
Sandeep Mewara 22-Nov-10 7:29am    
Just corrected the formatting.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900