Validation Controls in Item Template

4 posts, 0 answers
  1. Ranganath
    Ranganath avatar
    38 posts
    Member since:
    Jun 2008

    Posted 05 Oct 2009 Link to this post

    Hi,

    Here is the .ASPX Code for the RadGrid. Problem is, I am not able to Use Validation Controls(i.e.RequiredFieldValidator  etc…) for the “txtRfqDetSize , txtRfqDetCubic  AND  cboItemID “ controls in the following scenario.

    Any one will help me how to use Validation Controls in the following Scenario?

    <telerik:RadGrid ID="rgRFQDetails" runat="server" AllowPaging="True" GridLines="Horizontal"

    OnNeedDataSource="rgRFQDetails_NeedDataSource" Skin="Default" PageSize="10" Width="100%"

    OnUpdateCommand="rgRFQDetails_UpdateCommand" OnDeleteCommand="rgRFQDetails_DeleteCommand">

    <PagerStyle Mode="Slider" />

    <%--<AlternatingItemStyle BackColor="#F1EFE9" />--%>

    <MasterTableView AutoGenerateColumns="false" DataKeyNames="RFQDetails_RegSerLineNo"

    EditMode="InPlace" CommandItemStyle-CssClass="RGCmdHeader" CommandItemSettings-RefreshText="&nbsp;&nbsp;Refresh">

    <Columns>

    <telerik:GridBoundColumn Visible="false" DataField="RFQDetails_RegSerLineNo" HeaderText="Service L.No"

    HeaderStyle-Width="15%" HeaderStyle-CssClass="GridHeadernew" UniqueName="RFQDetails_RegSerLineNo"

    ReadOnly="True">

    </telerik:GridBoundColumn>

    <telerik:GridBoundColumn Visible="false" DataField="RFQDetails_RegSerCode" HeaderText="Service Code"

    HeaderStyle-Width="15%" HeaderStyle-CssClass="GridHeadernew" UniqueName="RFQDetails_RegSerCode"

    ReadOnly="True">

    </telerik:GridBoundColumn>

    <telerik:GridBoundColumn DataField="RFQDetails_RegSerName" HeaderText="Service Name"

    HeaderStyle-Width="15%" HeaderStyle-CssClass="GridHeadernew" UniqueName="RFQDetails_RegSerName"

    ReadOnly="True">

    </telerik:GridBoundColumn>

                                                                        <telerik:GridBoundColumn DataField="RFQDetails_Coordinator" HeaderText="Coordinator"

                                                                            HeaderStyle-Width="13%" HeaderStyle-CssClass="GridHeadernew" UniqueName="RFQDetails_Coordinator"

                                                                            ReadOnly="True">

                                                                        </telerik:GridBoundColumn>

                                                                        <telerik:GridBoundColumn DataField="Commodity" HeaderText="Commodity" HeaderStyle-Width="13%"

                                                                            HeaderStyle-CssClass="GridHeadernew" UniqueName="Commodity" ReadOnly="True">

                                                                        </telerik:GridBoundColumn>

                                                                        <telerik:GridBoundColumn DataField="RFQDetails_WeightInLbs" ItemStyle-HorizontalAlign="Right"

                                                                            HeaderText="Weights" HeaderStyle-Width="5%" HeaderStyle-CssClass="GridHeadernew"

                                                                            UniqueName="RFQDetails_WeightInLbs" ReadOnly="True">

                                                                        </telerik:GridBoundColumn>

                                                                        <telerik:GridTemplateColumn HeaderText="Size" UniqueName="RFQDetails_Size" ItemStyle-HorizontalAlign="Left"

                                                                            HeaderStyle-CssClass="GridHeadernew" HeaderStyle-Width="6%">

                                                                            <ItemTemplate>

                                                                                <telerik:RadTextBox Width="75%" Text='<%# Eval("RFQDetails_Size") %>' ID="txtRfqDetSize"

                                                                                    runat="server" onkeypress="fn_validateDecimal(this,'n')">

                                                                                </telerik:RadTextBox>

                                                                            </ItemTemplate>

                                                                        </telerik:GridTemplateColumn>

                                                                        <telerik:GridTemplateColumn HeaderText="Cubic" UniqueName="RFQDetails_Cubic" ItemStyle-HorizontalAlign="Left"

                                                                            HeaderStyle-CssClass="GridHeadernew" HeaderStyle-Width="6%">

                                                                            <ItemTemplate>

                                                                                <telerik:RadTextBox Width="75%" Text='<%# Eval("RFQDetails_Cubic") %>' ID="txtRfqDetCubic"

                                                                                    runat="server" onkeypress="fn_validateDecimal(this,'n')">

                                                                                </telerik:RadTextBox>

                                                                            </ItemTemplate>

                                                                        </telerik:GridTemplateColumn>

                                                                        <telerik:GridTemplateColumn HeaderText="UM" UniqueName="RFQDetails_UOM" HeaderStyle-CssClass="GridHeadernew">

                                                                            <ItemTemplate>

                                                                                <telerik:RadComboBox ID="cboItemID" DataTextField="Lookup_Value" DataValueField="Lookup_Key"

                                                                                    Text='<%# Bind("RFQDetails_UOM") %>' OnInit="RadComboBox1_Init" EnableLoadOnDemand="True"

                                                                                    runat="server" Width="100px">

                                                                                </telerik:RadComboBox>

                                                                            </ItemTemplate>

                                                                        </telerik:GridTemplateColumn>

                                                                        <telerik:GridTemplateColumn HeaderStyle-Width="7%" HeaderText="From" Visible="false"

                                                                            HeaderStyle-CssClass="GridHeadernew">

                                                                            <ItemTemplate>

                                                                                <asp:Label ID="lblServiceLine" runat="server" Text='<%#Bind("RFQDetails_RegSerLineNo") %>'></asp:Label>

                                                                                <asp:Label ID="lblServiceCode" runat="server" Text='<%#Bind("RFQDetails_RegSerCode") %>'></asp:Label>

                                                                            </ItemTemplate>

                                                                        </telerik:GridTemplateColumn>

                                                                       <telerik:GridButtonColumn ConfirmText="Are you Sure to Update the Record" ConfirmTitle="Update1"

                                                                            HeaderStyle-Width="3%" ButtonType="ImageButton" CommandName="Update" HeaderStyle-CssClass="GridHeadernew">

                                                                        </telerik:GridButtonColumn>

                                                                        <telerik:GridTemplateColumn HeaderText="Status" HeaderStyle-Width="8%" HeaderStyle-CssClass="GridHeadernew">

                                                                            <ItemStyle HorizontalAlign="Left" />

                                                                            <ItemTemplate>

                                                                                <asp:CheckBox runat="server" Width="70" ID="chkRFQDetStatus" AutoPostBack="true" Checked='<%# CheckRecordStatus((bool)Eval("IsActive"))%>'

                                                                                    Text='<%# CheckText((bool)Eval("IsActive"))%>' OnCheckedChanged="chkRFQDetStatus_CheckedChanged" />

                                                                            </ItemTemplate>

                                                                        </telerik:GridTemplateColumn>

    </Columns></MasterTableView></telerik:RadGrid>

    Regards,

    Ranganath.S

  2. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 08 Oct 2009 Link to this post

    Hello Ranganath,

    You can nest the validation control(s) in the item template, or in the editItemTemplate, and set the controltovalidate to the textboxes. Let me know how this approach meets your requirements, or if I am leaving something out.

    All the best,
    Yavor
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 08 Oct 2009 Link to this post

    Hi Ranganath,

    The following help document should help you understand better how to use validators for various columns. Check it out.
    Validation

    Thanks
    Princy.
  5. doug
    doug avatar
    3 posts
    Member since:
    Jul 2015

    Posted 03 May in reply to Ranganath Link to this post

    Use the HTML/Code formatting under formatting options, it's very difficult to understand your code otherwise
Back to Top