We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Accessing control in current row

Thread ID:





84527 Jul 1,2009 07:29 AM UTC Jul 6,2009 05:52 AM UTC ASP.NET Web Forms (Classic) 1
Tags: GridGroupingControl
Administrator [Syncfusion]
Asked On July 1, 2009 07:29 AM UTC

Lets say a user selected a row and entered edit mode.
A dropdown was loaded with certain values and a certain value was selected, now i would like to get to another dropdown in the same row and fill it with data.
In asp.net GridView it was something like this:

this.GridView1.Rows[this.GridView1.EditIndex].FindControl("someContorlId") as DropDownList

Rekha P [Syncfusion]
Replied On July 6, 2009 05:52 AM UTC

Hi Eran,

Thank you for your interest in Syncfusion Products.

The embedded controls (EditItemTemplate) in a Grid row can be accessed by iterating through Grid top level row. Please refer a code snippet below to achieve this using DataSourceControlRowUpdating event.

void GridGroupingControl1_DataSourceControlRowUpdating(object sender, GridDataSourceControlRowUpdateEventArgs e)
Label1.Text = "";

DropDownList dropdown = null;
foreach (TableRow row in this.GridGroupingControl1.TopLevelTable.Rows)
if (row is GridRow)
GridRow gridRow = row as GridRow;

if (gridRow.Record != null)
foreach (GridCell gridCell in gridRow.Cells)
if (gridCell.ColumnDescriptor.Name == "Country")
foreach (Control cntl in gridCell.Controls[0].Controls)
if (cntl is DropDownList)
dropdown = cntl as DropDownList;
GridCellTemplated grid = (GridCellTemplated)dropdown.Parent.Parent;
GridRow gridrow1 = grid.Row;

Label1.Text += gridrow1.Record.GetValue("EmployeeID") + "--" + gridrow1.Record.GetValue("FirstName") + "--" + dropdown.SelectedItem.Text + "
gridRow.Record.SetValue("Country", dropdown.SelectedItem.Text);

The steps followed here are,
- Get the TableRow in the TopLevelTable
- Check if that Row is GridRow if so Iterate the Gridcells
- Find the TemplatedControl and the value.

Refer a sample illustrating the above.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon