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

Very basic question

1 Answer 13 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 06 Jul 2012, 02:21 PM
Guys I am sorry I am following the below video tutorial and I am stumped


http://tv.telerik.com/watch/aspnet/radgrid/radgrid-edit-templates 

When I get to the part where I create Form Template. The author goes "You do not want to see me put this controls on" so then it fast forwards tills all the text boxes and buttons are on!!!!!!!

Thats what I want to see? I am new to this and need step by step instructions, if I am going to teach myself.

Is their a video where it shows you how to add the controls to a template?

Matt

1 Answer, 1 is accepted

Sort by
0
Elliott
Top achievements
Rank 2
answered on 06 Jul 2012, 03:41 PM
hey Dave
when I use a template I just add the columns in markup
<telerik:RadGrid ID="rgAddItems" AutoGenerateColumns="False" GridLines="Both" ShowFooter="true" runat="server">
    <MasterTableView DataKeyNames="PartNumberID" CommandItemDisplay="Bottom" NoDetailRecordsText="begin entering data" runat="server">
    <ItemStyle CssClass="grid_item_style" />
    <AlternatingItemStyle CssClass="grid_alternate_item_style" />
    <Columns>
        <telerik:GridBoundColumn UniqueName="PartNumberID" DataField="PartNumberID" Readonly="True" Visible="False"/>
        <telerik:GridTemplateColumn HeaderText="ItemID" Visible="False" >
            <ItemTemplate>
                <asp:Label ID="lblItemID" Text='<%# Bind("ItemID") %>' runat="server" />
            </ItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridBoundColumn UniqueName="PartNumber" DataField="PartNumber" HeaderText="Part Number" ReadOnly="True" />
        <telerik:GridTemplateColumn HeaderText="Item Description">
            <ItemTemplate>
                <asp:Label ID="lblItemDescription" Text='<%# Bind("Description") %>' runat="server" />
            </ItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridBoundColumn UniqueName="Qty" DataField="Qty" HeaderText="Quantity" />
        <telerik:GridEditCommandColumn EditText="Edit" />                    
        <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"/>    
    </Columns>
    <EditFormSettings EditFormType="Template">
        <EditColumn UniqueName="ecColumn" />
        <FormTemplate>
            <table border="0" cellpadding="2" cellspacing="2">
            <tr>
            <td>
                <asp:HiddenField ID="hdnPartNumberID" Value='<%# Bind("PartNumberID") %>' runat="server" />
            </td>
            <td>
                <asp:HiddenField ID="hdnItemID" Value='<%# Bind("ItemID") %>' runat="server" />
            </td>
            </tr>
            <tr>
            <td class="body_text_black_BOLD">Part Number</td>
            <td>
                <asp:TextBox ID="txtPartNumber" Text='<%# Bind("PartNumber") %>' CssClass="body_text_black" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="rfdPartNumber" ControlToValidate="txtPartNumber" ErrorMessage="Part Number Required" runat="server" />               
            </td>
            </tr>
            <tr>
            <td class="body_text_black_BOLD">Quantity</td>
            <td>
                <telerik:RadNumericTextBox ID="rntbQty" Text='<%# Bind("Qty") %>' MaxLength="5" MaxValue="9999" MinValue="1" CssClass="body_text_black" runat="server" >
                    <NumberFormat DecimalDigits="0" />
                </telerik:RadNumericTextBox>
                <asp:RequiredFieldValidator ID="rfQty" ControlToValidate="rntbQty" ErrorMessage="Quantity required" runat="server">
                </asp:RequiredFieldValidator>
            </td>
            </tr>
            <tr>
            <td>
                <asp:LinkButton ID="btnUpdate" Text='<%# IIF(TryCast(Container,GridItem).OwnerTableView.IsItemInserted,"Insert","Update") %>'  CommandName='<%# IIF(TryCast(Container,GridItem).OwnerTableView.IsItemInserted,"PerformInsert","Update") %>' runat="server" />
            </td>
            <td>
                <asp:LinkButton ID="btnCancel" Text="Cancel" CommandName="Cancel" CausesValidation="false" runat="server" />
            </td>
            </tr>
            </table>
        </FormTemplate>
    </EditFormSettings>
    </MasterTableView>
    <ClientSettings>
        <ClientEvents OnRowDblClick="RowDblClick" />
    </ClientSettings>
    </telerik:RadGrid>

note that templated columns have only an ItemTemplate
Tags
Grid
Asked by
Dave
Top achievements
Rank 1
Answers by
Elliott
Top achievements
Rank 2
Share this question
or