ASPxGridView.FocusedRowChanged Event
Fires when the row focus changes.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
Declaration
Event Data
The FocusedRowChanged event's data class is EventArgs.
Remarks
Set the ProcessFocusedRowChangedOnServer property to true
to allow the control to fire the server-side FocusedRowChanged
event.
The FocusedRowChanged
event fires in the following cases:
- A user moves row focus.
- You change the FocusedRowIndex property value.
- You call the SetFocusedRowIndex(visibleIndex) method.
If the ProcessFocusedRowChangedOnServer property is set to false
, the control raises the client-side ASPxClientGridView.FocusedRowChanged event.
Example
In the example below, the control raises the FocusedRowChanged
event to save and restore the focused row index on the server side.
<dx:ASPxGridView ID="gridView" runat="server" AutoGenerateColumns="False"
OnDataBound="gridView_DataBound" OnFocusedRowChanged="gridView_FocusedRowChanged">
<SettingsBehavior AllowFocusedRow="true" ProcessFocusedRowChangedOnServer="true" />
<Columns>
<%--...--%>
</Columns>
</dx:ASPxGridView>
protected void gridView_FocusedRowChanged(object sender, EventArgs e) {
ASPxGridView grid = sender as ASPxGridView;
Response.Cookies[grid.ID]["FocudedIndex"] = grid.FocusedRowIndex.ToString();
Response.Cookies[grid.ID].Expires = DateTime.Now.AddDays(1d);
}
protected void gridView_DataBound(object sender, EventArgs e) {
ASPxGridView grid = sender as ASPxGridView;
if(!IsPostBack)
if (Request.Cookies[grid.ID] != null)
grid.FocusedRowIndex = Convert.ToInt32(Request.Cookies[grid.ID]["FocudedIndex"]);
}
See Also