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

How can i access GridBoundColumn in radgrid1_PreRender

1 Answer 337 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dorababu
Top achievements
Rank 1
Dorababu asked on 05 Jul 2012, 11:31 AM
Is it possible to find grid bound column in grid prerender event of radgrid. I am trying to select the first row of radgrid on page load and display the values of selected row in second grid. Is there any other way to achieve rather than accessing the column i prerender event

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Sep 2012, 08:45 AM
Hi Dorababu,

I guess you want to access the Boundcolumn of the selected row(first row) in the PreRender event. Please take a look into the following code snippet.

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    RadGrid1.MasterTableView.Items[0].Selected = true; //making the first row selected
    foreach (GridDataItem dataItem in RadGrid1.Items)
    {
        if (dataItem.Selected == true)
        {
            foreach (GridColumn col in RadGrid1.Columns)
            {
                 
                if (col.ColumnType == "GridBoundColumn")
                {
                    if (col.UniqueName == "ShipCountry")
                    {
                        string value = dataItem["ShipCountry"].Text; //getting the value of the BoundColumn
                    }                
                }
            }
        }
    }
}

Thanks,
Shinu.
Tags
Grid
Asked by
Dorababu
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or