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

Mastertable and detailtables relationship

2 Answers 89 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Utarn Buranasaksee
Top achievements
Rank 1
Utarn Buranasaksee asked on 26 Oct 2011, 04:00 PM
Hi,
I'm creating a radgrid where i have master table outside and a detail table inside.
I already set ParentTableRelation.
  <DetailTables>
                    <telerik:GridTableView runat="server" AllowAutomaticDeletes="True"
                        AllowAutomaticUpdates="True" DataKeyNames="ID"
                        DataSourceID="EntityDataSource2" Name="TestChoice"
                        CommandItemDisplay="Top">
                        <ParentTableRelation>
                            <telerik:GridRelationFields DetailKeyField="OfQuestion" MasterKeyField="ID" />
                        </ParentTableRelation>
                  ....
 
</DetailTables>

It works fine when I have to enable client row selection in the master table and i need to select the row in the master before click that triangle to expand the detail table.

If I don't select any row in the master table and I just click expand the row, it shows nothing.

My questions are
1. do I have to set anything special in order to make it works without client row selection?
2. after inserting a new row, i just want the grid to stay in insert mode.
let say, if I insert a new row in a master table, i want my master table to stay in insert mode only; another table stays in readonly mode.
also if I insert a new row in a detail table, i want my detail table to stay in insert mode only; another table stays in readonly mode.
How can I do that?

Here is the first part of the RadGrid and the
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True"
          CellSpacing="0" DataSourceID="EntityDataSource1" GridLines="None" AllowCustomPaging="True"
          PageSize="25" AutoGenerateColumns="False">
          <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
              <Selecting AllowRowSelect="True" />
          </ClientSettings>
          <MasterTableView AllowAutomaticDeletes="True" AllowAutomaticUpdates="True"
              CommandItemDisplay="Top" DataKeyNames="ID"
              DataSourceID="EntityDataSource1" AllowCustomPaging="False"
              PageSize="10" Name="TestQuestion">

<
telerik:GridTableView runat="server" AllowAutomaticDeletes="True"
                       AllowAutomaticUpdates="True" DataKeyNames="ID"
                       DataSourceID="EntityDataSource2" Name="TestChoice"
                       CommandItemDisplay="Top">
                       <ParentTableRelation>
                           <telerik:GridRelationFields DetailKeyField="OfQuestion" MasterKeyField="ID" />
                       </ParentTableRelation>
                    ...


Best Regards,
Utharn
PS. Insertion and Updation operation work fine. and sorry, i write the column name in my native language so i didn't post the whole part.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 Oct 2011, 07:31 AM
Hello Utarn,

  1. In order to make the grid stay in Edit mode, make sure that you have set AllowAutomaticInserts as false.
  2. You can prevent columns from being edited by setting their ReadOnly property to True.
I cannot reproduce the first issue at my end. Check the following demo which implements Hierarchy using Declarative Relations.
Grid / Declarative Relations.

Thanks,
Shinu.
0
Utarn Buranasaksee
Top achievements
Rank 1
answered on 27 Oct 2011, 08:52 AM
Hi Shinu,

Today I just removed all the radgrids and recreated it again, and it works now. Maybe I added some wrong parameters. Anyway, I got my grid to stay in edit mode.

Thanks a lot.
Utharn
Tags
Grid
Asked by
Utarn Buranasaksee
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Utarn Buranasaksee
Top achievements
Rank 1
Share this question
or