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

Grid / Hierarchy with Templates Editing Data

5 Answers 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Peter Maslin
Top achievements
Rank 1
Peter Maslin asked on 24 Jul 2009, 11:43 AM
hi

i have been following the example from
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultcs.aspx

and taken it to the point where on each tab in the template the user can edit/add data within it.
also another difference is the RadGrids in each tab are only simple grids , no heirachy etc,

the problem i am having is accessing field data from the top level grid , as i need it for the insert forms.

currently the only time i seem to be able to access the ControllingRows Data is on the PreRender event of the Parent Grid , at any point after that i cant seem to access the Parent Row.


i dont know its at the right point , but on the InsertCommand for the grids in the innerContainer i cant seem to find a way to access the parent row from the top level grid.

can anyone suggest the correct way so access the data.

Peter.

5 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 29 Jul 2009, 09:39 AM
Hi Peter,

You can access the parent row as follows:

GridDataItem ParentItem = e.Item.OwnerTableView.ParentItem; 

I hope this information helps.

Regards,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Pieter
Top achievements
Rank 1
answered on 13 Jul 2011, 10:44 AM
hi

i have been following the example from
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultcs.aspx

and taken it to the point where on each tab in the template the user can edit/add data within it.
also another difference is the RadGrids in each tab are only simple grids , no heirachy etc,

the problem i am having is accessing  controls in tabs(DetailsView)()I've setup Detailsview DefaultMode="Edit", as i need it for the insert/Edit.

currently the only time i seem to be able to access the Controllis in (

protected

 

void Detailsview_ItemCommand(object sender, DetailsViewCommandEventArgs e)) i need to find contrlos in itemdatabound controls becouse i need to bound few controls depends on logged in user.

i dont know its at the right point .

can anyone suggest the correct way so access Controls in Tabs(DetailsView).

0
Shinu
Top achievements
Rank 2
answered on 13 Jul 2011, 11:32 AM
Hello Pieter,

You can access the TextBox control in detail table by attaching the event ItemDataBound as shown below.
aspx:
<telerik:GridTableView Name="Detail" DataKeyNames="OrderID" CommandItemDisplay="Top">                          
  <Columns>
      <telerik:GridTemplateColumn>
        <ItemTemplate>
            <asp:TextBox ID="TextBox1" runat="server" Text="hello"></asp:TextBox>
        </ItemTemplate>
      </telerik:GridTemplateColumn>
  </Columns>
</telerik:GridTableView>

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
      if (e.Item is GridDataItem && e.Item.OwnerTableView.Name == "Detail")
          {
            GridDataItem item = (GridDataItem)e.Item;
            TextBox tab = (TextBox)item.FindControl("TextBox1");
          }
}

Thanks,
Shinu.
0
Pieter
Top achievements
Rank 1
answered on 13 Jul 2011, 02:17 PM
Hi Shinu,

Thnaks for the replay,
I am not using the GridTableView , i am using DetailsView witch is inside pageview i can't use the itemdatabound while it's only ondatabound available so i can't use GridItemEventArgs (e.Item a\is not available)
can you suggest me another way please.

is there any way i can find mastertable datakeyvalue in protected void DetailsView _ItemDatabound(object sender, EventArgs e)

Thanks in advance.

0
Tsvetoslav
Telerik team
answered on 18 Jul 2011, 03:28 PM
Hi Pieter,

The DetailsView control is not a part of the Telerik suite - please, consult the MSDN documentation on how to achieve your requirement. 

Best wishes,
Tsvetoslav
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Grid
Asked by
Peter Maslin
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Pieter
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or