Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

ASPxGridView - How to store a focused row index in cookies when ProcessFocusedRowChangedOnServer="true"

$
0
0

The ASPxGridView does not save a focused row in cookies. However, you can add this capability by saving and restoring a focused row index to/from the cookies manually. If the ProcessFocusedRowChangedOnServer property is "true", changing of the focused row is processed on the server side. Thus, it is necessary to save and restore the focused index on the server side:

[C#]
protectedvoidgridView_FocusedRowChanged(objectsender,EventArgse){ASPxGridViewgrid=senderasASPxGridView;Response.Cookies[grid.ID]["FocudedIndex"]=grid.FocusedRowIndex.ToString();Response.Cookies[grid.ID].Expires=DateTime.Now.AddDays(1d);}protectedvoidgridView_DataBound(objectsender,EventArgse){ASPxGridViewgrid=senderasASPxGridView;if(!IsPostBack)if(Request.Cookies[grid.ID]!=null)grid.FocusedRowIndex=Convert.ToInt32(Request.Cookies[grid.ID]["FocudedIndex"]);}

Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>