This is a migrated thread and some comments may be shown as answers.

Get current selected row on postback

3 Answers 110 Views
Grid
This is a migrated thread and some comments may be shown as answers.
plusHR
Top achievements
Rank 1
plusHR asked on 03 May 2012, 02:52 PM
Hi, when I edit my record I have the radupload component, however when it does the postback I want to get the current value of the selected grid row as this contains the id to be used for the file name. Could you assist on how I can get this information sent back as I found the the RadAsyncUpload1_FileUploaded gets called before the command method. thanks P

3 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 03 May 2012, 03:51 PM
Hello Paul,

protected void Button1_Click1(object sender, EventArgs e)
   {
       foreach (GridEditableItem item in RadGrid1.EditItems)
       {
           // Access your Edited row here
       }
        
   }


Thanks,
Jayesh Goyani
0
Shinu
Top achievements
Rank 2
answered on 04 May 2012, 06:28 AM
Hello Paul,

I am not quite sure about your requirement. I suppose you want to access the DataKeyValue of the selected row. Here is the sample code.
C#:
protected void RadGrid1_SelectedIndexChanged(object sender, EventArgs e)
{
  foreach (GridDataItem item in RadGrid1.SelectedItems)
   {
     string value = item.GetDataKeyValue("ID").ToString();//accessing datakeynames
     int index = item.ItemIndex;//accessing row index
   }
}
Note:Set ClientSettings- EnablePostBackOnRowClick as true.

Thanks,
Shinu.
0
TonyG
Top achievements
Rank 1
answered on 08 May 2012, 06:58 AM
Ignore, sorry.
Tags
Grid
Asked by
plusHR
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Shinu
Top achievements
Rank 2
TonyG
Top achievements
Rank 1
Share this question
or