|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
What is the Equivalent of the CurrentRowIndex Property for a DataGrid Web Control?ASP.NET application: private void DataGrid1_CurrentCellChanged(object sender, EventArgs e) { int c = DataGrid1.CurrentRowIndex; DataGrid1.Select(c); DataGrid1_Click( sender, e); } The problem is that there is no CurrentRowIndex property for the DataGrid web control. Is there something else I can use, that will give me similar functionality? I also need to figure out what I can use in place of the Select method, which also doesn't exist for the DataGrid web control. Would SelectedIndex work? Can this method be adapted? Thanks!!! There is an OnItemCommand event that is triggered when a button within a row
is clicked which provides you with a parameter of type DataGridCommandEventArgs. This parameter supplies you with the equivalent of the CurrentRowIndex through its Item.ItemIndex property. In place of the select method you can add a Hyperlink or a LinkButton that triggers the selection. You can view the code for these methods in these demos: http://www.societopia.net/samples/dataGrid_3c.aspx http://www.societopia.net/samples/dataGrid_5c.aspx Show quoteHide quote ".NETn00b" wrote: > I am trying to convert the following windows app method, to use in an > ASP.NET application: > > private void DataGrid1_CurrentCellChanged(object sender, EventArgs e) > { > > int c = DataGrid1.CurrentRowIndex; > DataGrid1.Select(c); > DataGrid1_Click( sender, e); > > } > > The problem is that there is no CurrentRowIndex property for the > DataGrid web control. Is there something else I can use, that will give > me similar functionality? > > I also need to figure out what I can use in place of the Select method, > which also doesn't exist for the DataGrid web control. Would > SelectedIndex work? Can this method be adapted? > > Thanks!!! > >
Other interesting topics
Deploying ASP.NET 2.0
Web Development articles - where can I find some? Regular Expression Help (URL Rewriting) Don't Understand error DataGrid Pagin Problem ## in ASP.NET 2.0 How and when should I use CacheItemPriority.NotRemovable? Multilanguage calendar... Strange Behavior ASPnet_Wp.exe control events |
|||||||||||||||||||||||