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

'Drawing' hierarchy grid in usercontrol

4 Answers 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Borja
Top achievements
Rank 1
Borja asked on 31 May 2010, 12:18 PM
Hello,
I am working with a usercontrol to add/edit items in a RadGrid row
 
                <EditFormSettings UserControlName="EmployeeDetails.ascx" EditFormType="WebUserControl">  
                    <EditColumn UniqueName="EditCommandColumn1">  
                    </EditColumn> 
                </EditFormSettings> 
But each item/row can have associated another table in which I would like to be able to insert/edit so what i should see at the usercontrol is like another radgrid control. I have read in the live examples that this can be done with hierarchy and DetailTable, but I donĀ“t know how to 'draw' this table in the usercontrol so the items are binded to the employee detail showed in the usercontrol.

This is my UserControl
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EmployeeDetails.ascx.cs" Inherits="telerik_webGrid.EmployeeDetails" %> 
<table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="1" rules="none" 
    style="BORDER-COLLAPSE: collapse">  
        <tr class="EditFormHeader">  
        <td colspan="2"><b>Employee Details</b></td>  
    </tr> 
    <tr> 
        <td colspan="2"><b>Personal Info:</b></td>  
    </tr> 
    <tr> 
        <td> 
            <table id="Table3" cellspacing="1" cellpadding="1" width="100%" border="0">  
                <tr> 
                    <td></td>  
                    <td></td>  
                </tr> 
                <tr> 
                    <td>Country:</td> 
                    <td> 
                        <asp:TextBox id="TextBox7" runat="server" 
                        Text='<%# DataBinder.Eval( Container, "DataItem.Country"  ) %>'>  
                        </asp:textbox></td>  
                </tr> 
                <tr> 
                    <td>City:</td> 
                    <td> 
                        <asp:TextBox id="TextBox8" runat="server"   
                        Text='<%# DataBinder.Eval( Container, "DataItem.City") %>' 
                         tabIndex=1>  
                        </asp:textbox></td>  
                </tr> 
                <tr> 
                    <td>Region:</td> 
                    <td> 
                        <asp:TextBox id="TextBox9" runat="server" 
                        Text='<%# DataBinder.Eval( Container, "DataItem.Region") %>' 
                         tabIndex=2>  
                        </asp:textbox></td>  
                </tr> 
                <tr> 
                    <td>Home Phone:</td> 
                    <td> 
                        <asp:TextBox id="TextBox10" runat="server"   
                        Text='<%# DataBinder.Eval( Container, "DataItem.HomePhone") %>' 
                         tabIndex=3>  
                        </asp:textbox></td>  
                </tr> 
                <tr> 
                    <td>Birth Date:</td> 
                    <td> 
                        <asp:TextBox id="TextBox11" runat="server"   
                        Text='<%# DataBinder.Eval( Container, "DataItem.BirthDate") %>' 
                         tabIndex=4>  
                        </asp:textbox></td>  
                </tr> 
                <tr> 
                    <td>Title Of Courtesy</td> 
                    <td> 
                        <asp:dropdownlist id="ddlTOC" runat="server" tabindex="7"></asp:dropdownlist></td>  
                </tr> 
            </table> 
        </td> 
        <td> 
            <table id="Table1" cellspacing="1" cellpadding="1" width="300" border="0">  
                <tr> 
                    <td>Notes:  
                    </td> 
                </tr> 
                <tr> 
                    <td> 
                        <asp:TextBox id=TextBox1 Text='<%# DataBinder.Eval( Container, "DataItem.Notes") %>' runat="server" TextMode="MultiLine" Rows="5" Columns="40" tabIndex=5>  
                        </asp:textbox></td>  
                </tr> 
                <tr> 
                    <td>Address:</td> 
                </tr> 
                <tr> 
                    <td> 
                        <asp:TextBox id=TextBox6 Text='<%# DataBinder.Eval( Container, "DataItem.Address") %>' runat="server" TextMode="MultiLine" Rows="2" Columns="40" tabIndex=6>  
                        </asp:textbox></td>  
                </tr> 
            </table> 
        </td> 
    </tr> 
    <tr> 
        <td colspan="2"><b>Company Info:</b></td>  
    </tr> 
    <tr> 
        <td> 
            <table id="Table4" cellspacing="1" cellpadding="1" width="300" border="0">  
                <tr> 
                    <td>FirstName:</td> 
                    <td> 
                        <asp:TextBox id=TextBox2 Text='<%# DataBinder.Eval( Container, "DataItem.FirstName") %>' runat="server" tabIndex=8>  
                        </asp:textbox></td>  
                </tr> 
                <tr> 
                    <td>Last Name:</td> 
                    <td> 
                        <asp:TextBox id=TextBox3 Text='<%# DataBinder.Eval( Container, "DataItem.LastName") %>' runat="server" tabIndex=9>  
                        </asp:textbox></td>  
                </tr> 
                <tr> 
                    <td>Hire Date:</td> 
                    <td> 
                        <asp:TextBox id=Textbox5 Text='<%# DataBinder.Eval(Container, "DataItem.HireDate") %>' runat="server" tabIndex=10>  
                        </asp:textbox></td>  
                </tr> 
                <tr> 
                    <td>Title:</td> 
                    <td> 
                        <asp:TextBox id=TextBox4 Text='<%# DataBinder.Eval( Container, "DataItem.Title") %>' runat="server" tabIndex=11>  
                        </asp:textbox></td>  
                </tr> 
            </table> 
        </td> 
        <td></td>  
    </tr> 
    <tr> 
        <td colspan="2"><b>Tests</b></td>  
    </tr> 
    <tr> 
        <td> 
            <table id="Table5" cellspacing="1" cellpadding="1" width="300" border="0">  
                <tr> 
                    <td> 
                        <!--HERE SHOULD BE THE TABLE --> 
                    </td> 
                </tr> 
            </table> 
        </td> 
        <td></td>  
    </tr> 
    <tr> 
        <td align="right" colspan="2">  
            <asp:button id="btnUpdate" text="Update" runat="server" CommandName="Update" Visible='<%# !(DataItem is Telerik.Web.UI.GridInsertionObject) %>'></asp:button> 
            <asp:button id="btnInsert" text="Insert" runat="server" CommandName="PerformInsert" Visible='<%# DataItem is Telerik.Web.UI.GridInsertionObject %>'></asp:button> 
            &nbsp;  
            <asp:button id="btnCancel" text="Cancel" runat="server" causesvalidation="False" commandname="Cancel"></asp:button></td>  
    </tr> 
 

Thank you very much.

4 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 03 Jun 2010, 10:46 AM
Hello Borja,

Could you please elaborate a bit on your scenario? For instance where would you like the hierarchy to be, in the page where current you have one-level grid or in the user control used as edit form?

Any additional information would be of help.

Sincerely yours,
Iana
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Borja
Top achievements
Rank 1
answered on 03 Jun 2010, 11:03 AM
In general terms i would like to have a radgrid with rows, each row can be added or edited through PopUp editmode property and usercontrol, also, each row has another related table.

The master row is a client and the related table displays the orders placed by this client.

On the modal popup, I would like to show client data (name, surname, adresses...) and a grid where we can find his orders and where we can add, edit or delete these orders.

Is this possible with the <Detailstable> of a RadGrid?
0
Iana Tsolova
Telerik team
answered on 07 Jun 2010, 11:52 AM
Hello Borja,

the GridTableViews defined in the DetailTables collection are displayed under the respective parent items but in the edit form. You need to add another RadGrid in the main RadGrid edit form template.
 
Give it a try and let me know if you need further assistance.

Regards,
Iana
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Borja
Top achievements
Rank 1
answered on 08 Jun 2010, 04:09 PM
Then, is it possible to add a new radgrid control inside a usercontrol that we use as the main RadGrid edit form template? I thought that this wasnĀ“t possible so I tried to do this through detailtable. I will give it a try .

Thank you very much.
Tags
Grid
Asked by
Borja
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Borja
Top achievements
Rank 1
Share this question
or