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

Column Span an ItemTemplate? Edit mode

3 Answers 312 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mac
Top achievements
Rank 1
mac asked on 19 May 2011, 02:59 AM
Trying to get a TemplateColumn to span 3 columns when in edit mode.
Every time it renders in insert or edit, columns 1 and 2 are pushed out. I would like it so the checkbox list can run wild horizontally.  I build my checkbox list at ItemDataBound.


<MasterTableView EditMode="EditForms" AutoGenerateColumns="false" DataKeyNames="PK" CommandItemDisplay="Top">
<EditFormSettings ColumnNumber="3" >
</EditFormSettings>
<columns>
<telerik:GridTemplateColumn UniqueName="Assigned" EditFormColumnIndex="0" HeaderText="Assigned" >
<EditItemTemplate>
<asp:HiddenField ID="HidAssigned" runat="server" Value='<%# Eval("Assigned") %>' />
<asp:CheckBoxList RepeatDirection="Horizontal" ID="CBAssigned" Runat="server" />
</EditItemTemplate>
<ItemTemplate>
<%#Eval("Assigned") %>
</ItemTemplate>
</telerik:GridTemplateColumn>

3 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 24 May 2011, 11:33 AM
Hi Mac,

Thank you for contacting us.

I tried to reproduce the described issue, but to no avail. I am sending you a simple example based on your code. Please check it out and let me know what differs in your case.

Looking forward for your reply.

Kind regards,
Radoslav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
mac
Top achievements
Rank 1
answered on 24 May 2011, 03:53 PM
Hi Radoslav
if you expand your sample to add a couple more columns than just the two on column 0 then the issue is easily recreated.
your sample expanded:
ADD:

 

 

<telerik:GridBoundColumn EditFormColumnIndex="1" HeaderText="Col2" DataField="Col2" />

 

 

 

<telerik:GridBoundColumn EditFormColumnIndex="2" HeaderText="Col3" DataField="Col3" />

 


 

 

void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)

 

 

{

 

 

 

DataTable table = new DataTable();

 

 

table.Columns.Add(

 

"PK");

 

 

table.Columns.Add(

 

"Col2"); //added

 

table.Columns.Add(

 

"Col3"); //added

 

table.Columns.Add(

 

"Assigned", typeof(Boolean));

 

 

 

 

for (int i = 1; i < 8; i++)

 

 

{

 

table.Rows.Add(i,

 

true);

 

 

}

 

RadGrid1.DataSource = table;

 

}

 

}


Once you enter Edit mode, you will see that columns 1 and 2 are now pushed out to the end of column 0 checkboxlist. I would like to somehow merge cells 0,1,2 on the checkboxlist row.

0
Radoslav
Telerik team
answered on 27 May 2011, 08:52 AM
Hi Mac,

To achieve the desired functionality you could try setting the RadGrid.MasterTableView.TableLayout property to Fixed and set explicitly the Widths to the RadGrid, MasterTableView and the columns' HeaderStyle:
<telerik:RadGrid runat="server" Width="1130px" AutoGenerateEditColumn="true" ID="RadGrid1">
        <MasterTableView EditMode="EditForms" Width="1130px" TableLayout="Fixed" AutoGenerateColumns="false" DataKeyNames="PK"
            CommandItemDisplay="Top">
            <EditFormSettings ColumnNumber="3">
            </EditFormSettings>
            <Columns>
                <telerik:GridBoundColumn DataField="PK" HeaderText="PK">
                <HeaderStyle Width="100px" />
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn UniqueName="Assigned" EditFormColumnIndex="0" HeaderText="Assigned">
                <HeaderStyle Width="800px" />
                    <EditItemTemplate>
                        <asp:HiddenField ID="HidAssigned" runat="server" Value='<%# Eval("Assigned") %>' />
                        <asp:CheckBoxList RepeatDirection="Horizontal" ID="CBAssigned" runat="server" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <%#Eval("Assigned") %>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn EditFormColumnIndex="1" HeaderText="Col2" DataField="Col2" ><HeaderStyle Width="100px" /></telerik:GridBoundColumn>
                <telerik:GridBoundColumn EditFormColumnIndex="2" HeaderText="Col3" DataField="Col3" ><HeaderStyle Width="100px" /></telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>

Additionally I am sending you the modified version of the example.

Best wishes,
Radoslav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
mac
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
mac
Top achievements
Rank 1
Share this question
or