Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 12, 2009 05:03 PM by ahazut
0 Points
24 Posts
May 12, 2009 05:03 PM|LINK
Here I gave a tip about GridView and PagerTemplate:
http://forums.asp.net/t/1409011.aspx
and this tip is about saving pager index and sorting properties:
protected void Page_Unload(object sender, EventArgs e) { // Save grid view properties Session["MainGVP"] = string.Format("{0};{1};{2}", grdRecords.SortExpression, grdRecords.SortDirection, grdRecords.PageIndex); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Load grid view here
// Set grid view properties if (Session["MainGVP"] != null) { string[] Items = Session["MainGVP"].ToString().Split(';'); grdRecords.Sort(Items[0], (SortDirection)Enum.Parse(typeof(SortDirection), Items[1])); grdRecords.PageIndex = int.Parse(Items[2]); } } }
enjoy...
ahazut
0 Points
24 Posts
GridView and paging memory tip
May 12, 2009 05:03 PM|LINK
Here I gave a tip about GridView and PagerTemplate:
http://forums.asp.net/t/1409011.aspx
and this tip is about saving pager index and sorting properties:
protected void Page_Unload(object sender, EventArgs e)
{
// Save grid view properties
Session["MainGVP"] = string.Format("{0};{1};{2}", grdRecords.SortExpression, grdRecords.SortDirection, grdRecords.PageIndex);
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// Load grid view here
// Set grid view properties
if (Session["MainGVP"] != null)
{
string[] Items = Session["MainGVP"].ToString().Split(';');
grdRecords.Sort(Items[0], (SortDirection)Enum.Parse(typeof(SortDirection), Items[1]));
grdRecords.PageIndex = int.Parse(Items[2]);
}
}
}
enjoy...