I have a usercontrol inside webform with MasterPage. MasterPage has a logout button:
protected void lbtnLogout_Click(object sender, EventArgs e) { FormsAuthentication.SignOut(); Roles.DeleteCookie(); Session.Clear(); Response.Redirect("~/Account/WebLogin.aspx"); }
When I click the logout button, user control reboots until the event handler is called, causing an unnecessary trip to the database.
How do I handle postback? Is there a way to ignore it in usercontrol?
Thanks in advance.
Update: I should have mentioned earlier. I use the implementation structure of "WebFormsMvp". A Web form with MasterPage has several user controls, which are views that are attached to their respective presenters at runtime. I do not process Page_Load in any of the user controls, since the data is bound to each user control with a frame before the Page_Load event.
I will update the tag for this question accordingly.
source share