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

Edit cells with merged header.

1 Answer 71 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 19 Jan 2011, 04:07 PM
Hi!
I'm having a problem with the templateColumn. I can have a merged header, but for some reason, there's no way I can edit the value of the items under that column. I've been reading as many post as I could, but no answer so far.
I've tried different approaches, but the last best I could do was this:


<telerik:RadGrid ID="RadGrid1" EnableAJAX="True" ShowStatusBar="true" runat="server" Skin="Default" BorderColor="#97A222"  Width="95%"
            AutoGenerateColumns="False" PageSize="16" AllowSorting="True" AllowMultiRowSelection="False"
            AllowAutomaticDeletes="True" AllowAutomaticUpdates="True"
            AllowPaging="False" AllowScroll = "True" GridLines="None" OnDetailTableDataBind="RadGrid1_DetailTableDataBind" OnNeedDataSource="RadGrid1_NeedDataSource">
             
            <MasterTableView Width="100%" DataKeyNames="Name" AllowMultiColumnSorting="True">
                <DetailTables>
                    <telerik:GridTableView DataKeyNames="Name" DataMember="Details" Width="100%" GridLines="Horizontal"
                       AllowAutomaticDeletes="True" AllowAutomaticUpdates="True"
                        Style="border-color: #d5b96a" CssClass="RadGrid2">
                        <Columns>
                                
                               <telerik:GridEditCommandColumn UpdateText="Update" UniqueName="EditCommandColumn" CancelText="Cancel"
                                EditText="Edit">
                              <HeaderStyle Width="85px"></HeaderStyle>
                             
                            </telerik:GridEditCommandColumn>
                            <telerik:GridBoundColumn SortExpression="Name" HeaderText="Name" ReadOnly = "True" HeaderButtonType="TextButton"
                                DataField="Name">
                            </telerik:GridBoundColumn>
                            <telerik:GridTemplateColumn UniqueName="TemplateColumn">
                              <HeaderTemplate>
                               <table id="Table1" cellspacing="1" cellpadding="1" width="300" border="1">
                                <tr>
                                 <td colspan="2" align="center"><b>Revenue Growth Strategy</b></TD>
                                </tr>
                                <tr>
                                 <td width="50%"><b>Drive organic growth</b></TD>
                                 <td width="50%"><b>Global expansion</b></TD>
                                </TR>
                               </TABLE>
                              </HeaderTemplate>
                              <ItemTemplate>
                               <table id="Table2" cellspacing="1" cellpadding="1" width="300" border="1">
                                <tr>
                                 <td width="50%"><%# DataBinder.Eval(Container.DataItem , "Drive organic growth")%></TD>
                                 <td width="50%"><%# DataBinder.Eval(Container.DataItem, "Global expansion")%></TD>
                                </tr>
                               </table>
                              </ItemTemplate>
                           </telerik:GridTemplateColumn>
                             
                            <telerik:GridBoundColumn SortExpression="Drive organic growth" HeaderText="Drive organic growth" HeaderButtonType="TextButton"
                                DataField="Drive organic growth">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="Global expansion" HeaderText="Global expansion" HeaderButtonType="TextButton"
                                DataField="Global expansion">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="Market new products and services" HeaderText="Market new products and services" HeaderButtonType="TextButton"
                                DataField="Market new products and services">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="Operational improvement" HeaderText="Operational improvement" HeaderButtonType="TextButton"
                                DataField="Operational improvement">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="Technology initiatives" HeaderText="Technology initiatives" HeaderButtonType="TextButton"
                                DataField="Technology initiatives">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="Customer convenience" HeaderText="Customer convenience" HeaderButtonType="TextButton"
                                DataField="Customer convenience">
                            </telerik:GridBoundColumn>
                        </Columns>
                    </telerik:GridTableView>
                </DetailTables>
                <Columns>
                    <telerik:GridBoundColumn SortExpression="Name" HeaderText="Name" HeaderButtonType="TextButton"
                        DataField="Name">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>


I'll appreciate any help.

1 Answer, 1 is accepted

Sort by
0
Daniel
Top achievements
Rank 1
answered on 19 Jan 2011, 08:26 PM
Ok, I coded the solution myself.
Gotta use EditItemTemplate with a couple of textboxes.
Hope you find it useful!

<EditItemTemplate>
                              <table id="Table2" cellspacing="1" cellpadding="1" width="300" border="1">
                                <tr>
                                 <td width="50%"><asp:TextBox ID="txtDescription" Text='<%# Bind( "DriveOrganicGrowth") %>' runat="server"></asp:TextBox></TD>
                                 <td width="50%"><asp:TextBox ID="TextBox1" Text='<%# Bind( "GlobalExpansion") %>' runat="server"></asp:TextBox></TD>
                                </tr>
                               </table>
                              </EditItemTemplate>
                              <ItemTemplate>
                               <table id="Table2" cellspacing="1" cellpadding="1" width="300" border="1">
                                <tr>
                                 <td width="50%"><%# DataBinder.Eval(Container.DataItem , "DriveOrganicGrowth")%></TD>
                                 <td width="50%"><%# DataBinder.Eval(Container.DataItem, "GlobalExpansion")%></TD>
                                </tr>
                               </table>
                              </ItemTemplate>
Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Answers by
Daniel
Top achievements
Rank 1
Share this question
or