I have a WebDataGrid with Row Selection enabled. I have configured a server-side event for OnRowSelectionChanged, but it is not firing. Can you help me identify why?
<ig:WebDataGrid ID="WebDataGrid1" OnRowSelectionChanged="WebDataGrid1_OnRowSelectionChanged" runat="server" Height="350px" Width="400px"> <Columns> <ig:BoundDataField DataFieldName="GenericName" Hidden="True" Key="GenericName"> <Header Text="GenericName"> </Header> </ig:BoundDataField> </Columns> <Behaviors> <ig:ColumnResizing> </ig:ColumnResizing> <ig:ColumnMoving> </ig:ColumnMoving> <ig:EditingCore> <Behaviors> <ig:RowDeleting> </ig:RowDeleting> </Behaviors> </ig:EditingCore> <ig:Selection CellClickAction="Row" RowSelectType="Single" SelectedRowSelectorCssClass="orange"> </ig:Selection> <ig:RowSelectors> </ig:RowSelectors> <ig:Sorting> </ig:Sorting> </Behaviors> </ig:WebDataGrid>
On the server side, this method does not get hit:
protected void WebDataGrid1_OnRowSelectionChanged(object sender, SelectedRowEventArgs e) { return; }
Hello Adrian,
Thank you for providing the code snippet.
The ‘OnRowSelectionChanged’ event is not firing because grid need to have postback. For this ‘selection’ behavior should have AutoPostbackFlag enabled for the row selection .Your code would be like this:
<ig:Selection CellClickAction="Row" RowSelectType="Single" Enabled="true" >
<AutoPostBackFlags RowSelectionChanged="true" />
</ig:Selection>
Also set ‘EnableAjax’ property to false to cause a full page postback in the page.
For more information, you can also refer the below sample application.
https://es.infragistics.com/samples/aspnet/data-grid/selection-server-events
Please let me know if you need further assistance.