User Control (ASP.Net)


User Controls
When dealing with User Controls in the ASP.Net application, sometimes the post back to the code behind page does not happen as anticipated. For example, when you decide to bind a Control dynamically to the HTML templated and then assign an event handler to the Control bound, the postback always happens to the main page then transferred to the User Control code-behind, there are always tedious steps that have to happen. Sometimes this postbacks does not trigger the event handler of the Control and would end in the Page.Load() event. This becomes really hectic to debug when the User Control does not post to the intended code-behind class. Event Handler does not work as needed.

Solution

One way to overcome this problem is to use Sessions and Javascript. Create a function on the Front-end and bind the function to the control created dynamically or at Run-Time. This way, the Front-End will trigger the event and then puts the values like a Controls ID in a session for other pages to use.






For peering opportunity Autonomouse System Number: AS401345 Custom Software Development at ErnesTech Email Address[email protected]