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

Getting a Selected Column Values

4 Answers 37 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Omlac
Top achievements
Rank 1
Omlac asked on 03 Oct 2008, 09:21 AM
Hie all,
How do i get the selected column value, say column2 of the selected row.
in C#.
Thank you very much

4 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 03 Oct 2008, 09:48 AM
Hi Omlac,

You can access the selected column value in the PreRender event of the Grid using the column's UniqueName property as shown below.

CS:
  protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
 
        foreach (GridDataItem item in RadGrid1.MasterTableView.Items) 
        { 
            if (item.Selected) 
            { 
                string strSelectedtxt = item["ColumnUniqueName"].Text; 
            } 
        } 
   } 


Thanks
Shinu.
0
Omlac
Top achievements
Rank 1
answered on 03 Oct 2008, 09:57 AM
Thank you very much    
 But my grid is not posting back, would u know whats causing that, i had posted as differnt question but if u may assist that i will be very greatful
Thank you
0
Omlac
Top achievements
Rank 1
answered on 03 Oct 2008, 11:11 AM
thank you very much
0
Accepted
Princy
Top achievements
Rank 2
answered on 03 Oct 2008, 11:23 AM
Hi,

Try setting the EnablePostBackOnRowClick property to true as shown below.
aspx:
<RadGrid> 
<MasterTableView>  
 ... 
</MasterTableView> 
<ClientSettings EnablePostBackOnRowClick="true">                 
</ClientSettings> 
</RadGrid> 

Princy.
Tags
Grid
Asked by
Omlac
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Omlac
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or