Required Validator

6 posts, 0 answers
  1. Neil N
    Neil N avatar
    75 posts
    Member since:
    Aug 2012

    Posted 15 Feb 2013 Link to this post

    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?
  2. MasterChiefMasterChef
    MasterChiefMasterChef avatar
    152 posts
    Member since:
    Jan 2013

    Posted 15 Feb 2013 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Neil N
    Neil N avatar
    75 posts
    Member since:
    Aug 2012

    Posted 15 Feb 2013 Link to this post

    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>
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 17 Feb 2013 Link to this post

    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.
  6. Neil N
    Neil N avatar
    75 posts
    Member since:
    Aug 2012

    Posted 17 Feb 2013 Link to this post

    The exact version (in bin) is 2012.3.1308.40 which is newer than what is specified in the docs.
  7. Angel Petrov
    Admin
    Angel Petrov avatar
    1006 posts

    Posted 20 Feb 2013 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017