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

RadGrid - itemtemplate vs edititemtemplate

3 Answers 359 Views
UI for ASP.NET AJAX in ASP.NET MVC
This is a migrated thread and some comments may be shown as answers.
Stacy
Top achievements
Rank 1
Stacy asked on 15 Mar 2012, 05:49 PM
Hi,

I am having an issue that I hope you can help me out with.  Perhaps I am using item template and edit item template wrong.  I have a grid that contains an <itemtemplate> and an <edititemtemplate>.  I was under the assumption that when my grid loads up in view mode, it would display what's in the <itemtemplate>.  Then when I go to edit mode, it would display the items in <edititemtemplate>.  However I am seeing that it's using <itemtemplate> in both cases.  Is this how it's supposed to work?  My grid code is below:  (keep in mind some custom controls are in the grid and i can tell that it's using <itemtemplate> in view and edit mode because of the LabelText "item temp column".

<wasp:WLPGrid
    ID="GroupGrid"
    EditMode="InPlace"
    runat="server"
    GridLines="None"
    AutoGenerateColumns="False"
    Width="100%"
    AutoInsertOnAdd="false"
    AllowMultiRowEdit="true"
    skin=""
    >
 
    <ClientSettings>
        <Selecting AllowRowSelect="True" />
    </ClientSettings>
 
    <MasterTableView CommandItemDisplay="Top" DataKeyNames="Key" Width="100%">
        <CommandItemTemplate></CommandItemTemplate>
        <Columns>
            <wasp:GridTemplateControl UniqueName="HeaderColumns">
                <ItemTemplate>
                    <table width="100%">
                      <tr>
                        <td colspan="2">
                            <wasp:CheckBoxControl ID="IsGroupSelected" LabelText="Selected" runat="server" ResourceName="IsGroupSelected" Value='<%# Bind("IsGroupSelected") %>' ReadOnly="true" />
                        </td>
                      </tr>
                      <tr>
                        <td>
                            <wasp:TextBoxControl ID="EnglishDesc" LabelText="item temp column" runat="server" ResourceName="EnglishDesc" Value='<%# Bind("EnglishDesc") %>' ReadOnly="true" />
                        </td>
                        <td>
                            <wasp:TextBoxControl ID="FrenchDesc" LabelText="French Desc:" runat="server" ResourceName="FrenchDesc" Value='<%# Bind("FrenchDesc") %>' ReadOnly="true" />
                        </td>
                      </tr>
                      <tr>
                        <td>
                            <wasp:ComboBoxControl ID="DatabaseSecurityRoleId" LabelText="Database Role" runat="server" Type="DatabaseSecurityRoleId" ondatabinding="PopulateCombo" ResourceName="DatabaseSecurityRoleId" Value='<%# Bind("DatabaseSecurityRoleId") %>' ReadOnly="true"></wasp:ComboBoxControl>
                        </td>
                        <td>
                            <wasp:ComboBoxControl ID="GuiSecurityRoleId" LabelText="GUI Role" runat="server" Type="GuiSecurityRoleId" ondatabinding="PopulateCombo" ResourceName="GuiSecurityRoleId" Value='<%# Bind("GuiSecurityRoleId") %>' ReadOnly="true"></wasp:ComboBoxControl>
                        </td>
                      </tr>
                    </table>
                    <hr />
                </ItemTemplate>
                <EditItemTemplate>
                    <table width="100%">
                      <tr>
                        <td>
                            <wasp:CheckBoxControl ID="IsGroupSelected" LabelText="Selected" runat="server" ResourceName="IsGroupSelected" Value='<%# Bind("IsGroupSelected") %>' ReadOnly="false" />
                        </td>
                      </tr>
                      <tr>
                        <td>
                            <wasp:TextBoxControl ID="EnglishDesc" LabelText="edit item column" runat="server" ResourceName="EnglishDesc" Value='<%# Bind("EnglishDesc") %>' ReadOnly="true" />
                        </td>
                        <td>
                            <wasp:TextBoxControl ID="FrenchDesc" LabelText="French Desc:" runat="server" ResourceName="FrenchDesc" Value='<%# Bind("FrenchDesc") %>' ReadOnly="true" />
                        </td>
                      </tr>
                      <tr>
                        <td>
                            <wasp:ComboBoxControl ID="DatabaseSecurityRoleId" LabelText="Database Role" runat="server" Type="DatabaseSecurityRoleId" ondatabinding="PopulateCombo" ResourceName="DatabaseSecurityRoleId" Value='<%# Bind("DatabaseSecurityRoleId") %>' ReadOnly="true"></wasp:ComboBoxControl>
                        </td>
                        <td>
                            <wasp:ComboBoxControl ID="GuiSecurityRoleId" LabelText="GUI Role" runat="server" Type="GuiSecurityRoleId" ondatabinding="PopulateCombo" ResourceName="GuiSecurityRoleId" Value='<%# Bind("GuiSecurityRoleId") %>' ReadOnly="true"></wasp:ComboBoxControl>
                        </td>
                      </tr>
                    </table>
                    <hr />
                </EditItemTemplate>
            </wasp:GridTemplateControl>
        </Columns>
    </MasterTableView>

3 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 20 Mar 2012, 02:02 PM
Hello Stacy,

You have correctly understood the idea of the template column but from what I see your ItemTemplate and EditItemTemplate are identical, what is the difference that you expect to see in this scenario?

Regards,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Stacy
Top achievements
Rank 1
answered on 20 Mar 2012, 06:08 PM
The templates are identical just because i pasted them that way, i changed the labels on my textboxbox's so that's how i knew it was always using the item template.  Was just wondering if that's because the edit mode is "in line"?
0
Tsvetina
Telerik team
answered on 23 Mar 2012, 09:16 AM
Hi Stacy,

This would not make a difference, the GridTemplateColumn would always use its EditItemTemplate when in edit mode. If you still experience this problem, would it be possible that you open a support ticket and send us a runnable sample demonstrating the issue. We will debug it and let you know why it happens and how to fix it.

All the best,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
UI for ASP.NET AJAX in ASP.NET MVC
Asked by
Stacy
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Stacy
Top achievements
Rank 1
Share this question
or