|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Referencing Datagrid Rows while Datagrid is SortedI see this question raised often elsewhere, but I haven't yet found an
answer. When a datagrid is sorted, referencing a specific row is a problem. In my applications I frequently use datagrids and I must tell my users "If you are going to edit/update/delete a record from a datagrid, make sure you don't have it sorted first because you'll perform the action on the wrong record." Is there a way to work around the problem of sorting a datagrid and then referencing it's records? Thanks. Hi Mike,
It's no problem to let them sort still and also let them edit the data. Look in the DataGridCommandEventArgs of the update event to get the DataGrid row instead of EditItemIndex to get the updates for your DataTable. This way your DataGrid can be more flexable: private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { string updatedText = e.Item.Cells[0].Text; } Cheers, Steve Goodyear Hi Steve,
Thank you very much for that valuable information!! Show quoteHide quote "Steve Goodyear" wrote: > Hi Mike, > > It's no problem to let them sort still and also let them edit the data. Look > in the DataGridCommandEventArgs of the update event to get the DataGrid row > instead of EditItemIndex to get the updates for your DataTable. This way your > DataGrid can be more flexable: > > private void DataGrid1_UpdateCommand(object source, > System.Web.UI.WebControls.DataGridCommandEventArgs e) > { > string updatedText = e.Item.Cells[0].Text; > } > > Cheers, > Steve Goodyear
How to react to an ImageButon in a DataList ?
AutoPostBack How can I use my Own control in DataGrid? Can we have more than 1 'control to validate' for a single validat Datalist Dynamic Template Loading Problem Detailsview empty dataset insert TextBox.Text not getting the proper value error messages and focus TableCell Text Wrapping Problem! Infragistics UltraWebTab & RequiredFieldValidator |
|||||||||||||||||||||||