Hi Guys,
I'm Working with ViewState in my project to reduce the cycles of data loading again and again.
It's not working! Please help me
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if ((object)ViewState["GridView"] != null)
{
global_functions.load_gridview(grd_master_district, (object)ViewState["GridView"]);
}
else
{
load_Grid_View();
}
}
}
private void load_Grid_View()
{
try
{
Object obj = ClassBO.load_Master_District();
ViewState["GridView"] = obj;
global_functions.load_gridview(grd_master_district, obj);
}
catch (Exception ex)
{
ex.Message.ToString();
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", "alert('Something Went Wrong!.')", true);
}
}