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

Required Validator

5 Answers 139 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Neil N
Top achievements
Rank 1
Veteran
Iron
Neil N asked on 15 Feb 2013, 04:05 PM
This two minute exercise has somehow turned into two hours.  I'm following the directions on http://www.telerik.com/help/aspnet-ajax/grid-validation.html and trying to declaratively add a required field validator (2012 Q3 controls):

        <telerik:GridBoundColumn DataField="nOrder" DataType="System.Int32"
            FilterControlAltText="Filter Order column" HeaderText="Order"
            SortExpression="nOrder" UniqueName="nOrder" HeaderStyle-Width="5%">
<HeaderStyle Width="5%"></HeaderStyle>
    <ColumnValidationSettings EnableRequiredFieldValidation="true" EnableModelErrorMessageValidation="true">
        <RequiredFieldValidator ForeColor="Red" ErrorMessage="This field is required"></RequiredFieldValidator>
    </ColumnValidationSettings>
        </telerik:GridBoundColumn>

Which results in:
Error    3    Type 'Telerik.Web.UI.GridBoundColumn' does not have a public property named 'ColumnValidationSettings'.
Error    4    Type 'Telerik.Web.UI.GridBoundColumn' does not have a public property named 'RequiredFieldValidator'.

What gives? What did I miss?

5 Answers, 1 is accepted

Sort by
0
MasterChiefMasterChef
Top achievements
Rank 2
answered on 15 Feb 2013, 05:42 PM
Hi Neil,

This is a strange issue, and may have something to do with your HeaderStyle tag declaration between the GridBoundColumn and the columnValidationSettings tags. Try taking this header style out temporarily as it may be giving the GridBoundColumn an issue connecting with the ColumnValidationSettings. 

Hopefully this helps,
Master Chief
0
Neil N
Top achievements
Rank 1
Veteran
Iron
answered on 15 Feb 2013, 06:01 PM
Nope.  I even created a very simple grid to test.  Same error. And intellisense only exposes the FilterTemplate, FooterStyle, HeaderStyle, and ItemStyle properties (see screenshot).

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
  <telerik:RadGrid ID="grdtext" runat="server" CellSpacing="0"
        DataSourceID="SqlDataSource1" GridLines="None">
<MasterTableView AutoGenerateColumns="False" DataKeyNames="sUserID"
          DataSourceID="SqlDataSource1">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
 
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
 
    <Columns>
        <telerik:GridBoundColumn DataField="sUserID"
            FilterControlAltText="Filter sUserID column" HeaderText="sUserID"
            ReadOnly="True" SortExpression="sUserID" UniqueName="sUserID">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="sPassword"
            FilterControlAltText="Filter sPassword column" HeaderText="sPassword"
            SortExpression="sPassword" UniqueName="sPassword">
                <ColumnValidationSettings EnableRequiredFieldValidation="true" EnableModelErrorMessageValidation="true">
        <RequiredFieldValidator ForeColor="Red" ErrorMessage="This field is required"></RequiredFieldValidator>
    </ColumnValidationSettings>
        </telerik:GridBoundColumn>
    </Columns>
 
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
</MasterTableView>
 
<FilterMenu EnableImageSprites="False"></FilterMenu>
    </telerik:RadGrid>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="<%$ ConnectionStrings:appconnection %>"
        SelectCommand="SELECT [sUserID], [sPassword] FROM [Administrators]">
    </asp:SqlDataSource>
    </form>
     
</body>
</html>
0
Shinu
Top achievements
Rank 1
answered on 18 Feb 2013, 05:02 AM
Hi,

Please specify the version you are using. I was able to get the ColumnValidationSettings in the Intellisense. I am using 2013, 1, 130, 35 version. Please take a look into this help documentation and make sure that you are using Telerik version which provides the property.

Thanks,
Shinu.
0
Neil N
Top achievements
Rank 1
Veteran
Iron
answered on 18 Feb 2013, 05:10 AM
The exact version (in bin) is 2012.3.1308.40 which is newer than what is specified in the docs.
0
Angel Petrov
Telerik team
answered on 20 Feb 2013, 12:18 PM
Hi Neil,

The ColumnValidationSettings are introduced in the Q1 2013 version. Please update in order to take advantage of this functionality.

We will make the appropriate changes in our documentation as soon as possible.

All the best,
Angel Petrov
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
Grid
Asked by
Neil N
Top achievements
Rank 1
Veteran
Iron
Answers by
MasterChiefMasterChef
Top achievements
Rank 2
Neil N
Top achievements
Rank 1
Veteran
Iron
Shinu
Top achievements
Rank 1
Angel Petrov
Telerik team
Share this question
or