I have a RadGrid where multiple rows can be selected. But whatever 1 Row the user clicks on, that is the one I want to show the details for. Currently, if I click on a Row that has NOT been selected already, I can get the ID using RadGrid.SelectedValue. But if I click on a Row that has been ALREADY selected, I get the ID of the Row that was selected BEFORE the currently selected Row. Should I be getting it some other way?
thanks
mark
Code:
thanks
mark
Code:
<P>protected void radgridSearchResults_SelectedIndexChanged(object sender, EventArgs e)<BR> {<BR> //get the Selected Row and populate the Details...<BR> try<BR> {<BR> if (radgridSearchResults.SelectedValue != null)<BR> {<BR> //GridDataItem dataItem = (GridDataItem)radgridSearchResults.SelectedItems[radgridSearchResults.SelectedItems.Count - 1];<BR> //int selectedIndex = int.Parse(ViewState["CurrentRowIndex"].ToString());<BR> //GridDataItem dataItem = (GridDataItem)radgridSearchResults.SelectedItems[selectedIndex];<BR> //var scriptId = dataItem.GetDataKeyValue("id").ToString();</P> <P> var scriptId = radgridSearchResults.SelectedValue.ToString();</P> <P> ViewState[Globals.CurrentScriptId] = scriptId;<BR> //Pass Id to another function...
setDetails(int.Parse(scriptId.ToString()));<BR> }<BR> }<BR> catch (System.Exception ex)<BR> {<BR> //Error code removed....
return;<BR> }<BR> }</P>