Search This Blog

Page init event in

Posted by Team on
Init is actually a event which is available for every individual control on a Asp.Net page. So you can use this event for any of the control on your page or use it for Page as well.
Page_Init event is fired before the Page_Load, We can perform here task related to user authentication and change master page applied to the page. This may also be useful for changing theme of the pages.
protected void Page_Init(object sender, EventArgs e)
int LoginId = Convert.ToInt32(SqlHelper.ExecuteScalar(Config.ConnectionStringName, "Check_User_Logged_In", Convert.ToInt32(Session["LoginUserId"]),Convert.ToString(Session.SessionID)));
if (LoginId == 0)

If you are not done yet MSDN's Reference waiting for you.