I want to remove the view state using the method below. My problem is I don’t like it put the code below into almost every page. I like to move it to the masterpage or convert it to a class and run it from the masterpage.
The code below on works on the non-masterpage .
It will have this problem if I put inside the masterpage CS0115: ‘MasterPage.SavePageStateToPersistenceMedium(object)’: no suitable method found to override
#region Disable ViewState
protected override void SavePageStateToPersistenceMedium(object state)
{
}
protected override object LoadPageStateFromPersistenceMedium()
{
return null;
}
#endregion
Place the code below on the master page.
Use this technique to detect the clicked button on your aspx page(not the master page). Place this code in the code behind
if (Request.Form[“nonPostBackButton1.y”] != null)
{
Response.Write(“
nonPostBackButton1 is just pressed“);
}
This is the sample of the image submit buttons