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

Edit Template form not show up

1 Answer 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bogice
Top achievements
Rank 1
Bogice asked on 09 Jul 2010, 09:38 PM
Hi Telerik,
I have a Grid with Edit form. I made a gridTemplateColumn in "Normal Mode" in which i have a link button to simulate the Edit command. However when i click on this link button, the template form isnt show up. Do i miss something? here is the code snippet.
<telerik:RadGrid runat="server" ID="grdEmployee" Width="860px" AutoGenerateColumns="false"
    AllowSorting="true" OnItemCommand="grdEmployee_ItemCommand" OnSortCommand="grdEmployee_SortCommand"
    OnPageIndexChanged="grdEmployee_PageIndexChanged" OnNeedDataSource="grdEmployee_NeedDataSource"
    OnItemCreated="grdEmployee_ItemCreated" OnItemDataBound="grdEmployee_ItemDataBound">
    <MasterTableView TableLayout="Auto" CommandItemDisplay="Top" EditMode="EditForms">
        <CommandItemSettings ShowAddNewRecordButton="true" ShowRefreshButton="false" ShowExportToCsvButton="true"
            ShowExportToExcelButton="true" ShowExportToPdfButton="true" ShowExportToWordButton="true" />
         
        <Columns>
            <telerik:GridEditCommandColumn>
            </telerik:GridEditCommandColumn>
            <telerik:GridTemplateColumn HeaderText="Name" DataField="FirstName" UniqueName="NameColumn"
                SortExpression="FirstName">
                <ItemStyle Width="100px" HorizontalAlign="Center" />
                <HeaderStyle Width="100px" HorizontalAlign="Center" />
                <ItemTemplate>
                    <asp:LinkButton runat="server" ID="lnkName" CommandArgument='<%#Eval("UserID")%>'
                        CommandName="cmdUserProfileEditing" Text='<%# DataBinder.Eval(Container, "DataItem.FirstName").ToString() +" "+ DataBinder.Eval(Container, "DataItem.LastName").ToString()  %>'></asp:LinkButton>
                    <asp:Label runat="server" ID="lblName" Text='<%# DataBinder.Eval(Container, "DataItem.FirstName").ToString() +" "+ DataBinder.Eval(Container, "DataItem.LastName").ToString()  %>'
                        Visible="false"></asp:Label>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridBoundColumn HeaderText="Department" DataField="DepartmentName" UniqueName="Department">
                <ItemStyle Width="130px" HorizontalAlign="Center" />
                <HeaderStyle Width="130px" HorizontalAlign="Center" />
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Location/Office" DataField="LocationName" UniqueName="LocationName">
                <ItemStyle Width="130px" HorizontalAlign="Center" />
                <HeaderStyle Width="130px" HorizontalAlign="Center" />
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Title" DataField="Title" UniqueName="TitleColumn">
                <ItemStyle Width="100px" HorizontalAlign="Center" />
                <HeaderStyle Width="100px" HorizontalAlign="Center" />
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Phone" DataField="phone" UniqueName="Phone">
                <ItemStyle Width="120px" HorizontalAlign="Center" />
                <HeaderStyle Width="120px" HorizontalAlign="Center" />
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Int. Extension" DataField="phoneext" UniqueName="Extension">
                <ItemStyle Width="70px" HorizontalAlign="Center" />
                <HeaderStyle Width="70px" HorizontalAlign="Center" />
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Cell" DataField="phone2" UniqueName="Cellphone">
                <ItemStyle Width="120px" HorizontalAlign="Center" />
                <HeaderStyle Width="120px" HorizontalAlign="Center" />
            </telerik:GridBoundColumn>
        </Columns>
        <EditFormSettings EditFormType="Template">
            <FormTemplate>
                <div style="margin-left: 50px">
                    <table cellspacing="2" cellpadding="1" width="100%">
                        <tr>
                            <td>
                                Department
                            </td>
                            <td>
                                 
                            </td>
                            <td>
                                <telerik:RadComboBox runat="server" ID="cboDept" Height="200px" DataSource='<%#GetDepartment() %>'
                                    DataTextField="Name" DataValueField="DepartmentID" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Location
                            </td>
                            <td>
                                 
                            </td>
                            <td>
                                <telerik:RadComboBox runat="server" ID="cboLoc" Height="200px" DataSource='<%#GetLocation() %>'
                                    DataTextField="LocationName" DataValueField="LocationID" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Title
                            </td>
                            <td>
                                 
                            </td>
                            <td>
                                <asp:TextBox runat="server" ID="txtTitle" Text='<%#Bind("Title") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Phone
                            </td>
                            <td>
                                 
                            </td>
                            <td>
                                <asp:TextBox runat="server" ID="txtPhone" />
                            </td>
                        </tr>
                        <tr>
                            <td align="right" colspan="3">
                                <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                    runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                </asp:Button
                                <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                    CommandName="Cancel"></asp:Button>
                            </td>
                        </tr>
                    </table>
                </div>
            </FormTemplate>
        </EditFormSettings>
    </MasterTableView>
    <PagerStyle AlwaysVisible="true" Mode="NextPrev" />
    <ClientSettings EnableAlternatingItems="true" EnableRowHoverStyle="true">
        <Scrolling AllowScroll="true" ScrollHeight="400px" UseStaticHeaders="true" />
    </ClientSettings>
    <ExportSettings HideStructureColumns="true" ExportOnlyData="true" IgnorePaging="true"
        OpenInNewWindow="true">
    </ExportSettings>
</telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Bogice
Top achievements
Rank 1
answered on 09 Jul 2010, 10:03 PM
Nevermind, i figure out, the command name need to be "Edit" instead of "cmdUserEditProfile"
Tags
Grid
Asked by
Bogice
Top achievements
Rank 1
Answers by
Bogice
Top achievements
Rank 1
Share this question
or