i have two buttons . view and viewdaywise.
i need to know which button is clicked right now.
how to store that in session / or any other choice???
i have two buttons . view and viewdaywise.
i need to know which button is clicked right now.
how to store that in session / or any other choice???
You cannot store the Button as it's non-serializable, however you can store the ID of button:
private void LogLastButton(Button button)
{
Session["LastButtonId"] = button.ID;
}
protected void ButtonView_Click(object sender, EventArgs e)
{
this.LogLastButton((Button)sender);
}
protected void ButtonViewDayWise_Click(object sender, EventArgs e)
{
this.LogLastButton((Button)sender);
}
Then to retrieve the button, you can do something along the lines of the following:
Button lastButton = Page.Controls.Find(Session["LastButtonId"].ToString());