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

One usercontrol to edit data in a 2 lvl datagrid

1 Answer 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 25 Oct 2012, 12:51 PM
Hi team,

Based on http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/usercontroleditform/defaultcs.aspx, where I instead is working with a gridview with a hierarchy - i'm trying to create a user control wherefrom the user can update data from both levels of the datagrid when pressing 'Edit' on an item in the top level of the grid.

My problem is that for items within the second level I cant bind them as shown below: (for the top level)

<telerik:RadTextBox ID="FunctionTextBox" runat="server" Width="100%" Text='<%# DataBinder.Eval( Container, "DataItem.function_description") %>'></telerik:RadTextBox>

Is there a way to accomplish this?

I've also unsuccessfully been trying to access the gridview directly from the code behind file of the user control with the following:

RadGrid r = (RadGrid)this.Parent.FindControl("TerminalGrid");

Please let me know if you need more data and I'll try to supply it.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 30 Oct 2012, 10:02 AM
Hi,

 The declarative binding is applicable when the databound container that will be used to evaluate the binding expression contains the specified property, otherwise an exception will be thrown. Another option is to bind the controls inside the user control in the code-behind. For this purpose you can use the NamingContainer property of the user control which should hold a reference to the GridEditFormItem of the grid when it is in edit mode. From there you can access the MasterTableView and the grid (through the OwnerTableView property) as well as any other needed information from the parent control.

Kind regards,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Thomas
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or