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

Validation Controls in Item Template

3 Answers 284 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ranganath
Top achievements
Rank 1
Ranganath asked on 05 Oct 2009, 11:24 AM

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

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 08 Oct 2009, 06:15 AM
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.
0
Princy
Top achievements
Rank 2
answered on 08 Oct 2009, 06:40 AM
Hi Ranganath,

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

Thanks
Princy.
0
JazzBox
Top achievements
Rank 1
answered on 03 May 2016, 01:58 PM
Use the HTML/Code formatting under formatting options, it's very difficult to understand your code otherwise
Tags
Grid
Asked by
Ranganath
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Princy
Top achievements
Rank 2
JazzBox
Top achievements
Rank 1
Share this question
or