How to make GridTemplateColumn mandatory?

2 posts, 0 answers
  1. Nathalie
    Nathalie avatar
    1 posts
    Member since:
    Sep 2018

    Posted 27 Sep 2018 Link to this post

    I need to make one grid column as the mandatory field.

    I know how to make it with any separate control. E.g. I can type:

    <sq8:GridBoundColumn DataField="txtField" HeaderText="txtField"SortExpression="txtField" UniqueName="txtField" FilterControlAltText="">
    <RequiredFieldValidator ForeColor=""></RequiredFieldValidator>


    And I can use this Validator for the TextBox:

    <sq8:Label runat="server" Text="Field:" ID="Label1" Width="100%"></sq8:Label>
    <sq8:TextBox runat="server" ID="txtField" Width="100%"></sq8:TextBox>
    <sq8:RequiredFieldValidator runat="server" ErrorMessage="RequiredFieldValidator" ID="RequiredFieldValidator4" ControlToValidate="txtField" SetFocusOnError="True">*</sq8:RequiredFieldValidator>
    <sq:BindableControl runat="server" TargetControlID="txtField"DataField="txtField"></sq:BindableControl>


    And it works. User can't send the form because he gets an error - the field is empty.

    But I need to do the same with grid.

    When I open "Edit columns" in Grid Wizard I can't see any property as "mandatory" or something like this.
    And the code with RequiredFieldValidator doesn't work with a grid column. If I try to use it:

    <sq8:GridBoundColumn DataField="txtFieldGrid" HeaderText="txtFieldGrid" SortExpression="txtFieldGrid" UniqueName="txtFieldGrid" FilterControlAltText="">
    <sq8:RequiredFieldValidator runat="server" ErrorMessage="RequiredFieldValidator" ID="RequiredFieldValidator4" ControlToValidate="txtFieldGrid" SetFocusOnError="True">*</sq8:RequiredFieldValidator>
    <sq:BindableControl runat="server" TargetControlID="txtFieldGrid"DataField="txtFieldGrid"></sq:BindableControl>


    In this case, I have an error (look at screenshot)

    Is there some method for grid column validation? Or it's impossible with a grid?

  2. Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    3575 posts

    Posted 28 Sep 2018 Link to this post

    Hello, Nathalie,  

    I would like to note that this forum is related to the Telerik UI for WinForms suite. However, it seems that you are using another product. Feel free to post your technical questions in the relevant forum: Thus, our community will gladly assist you.

    I hope this information helps.

    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top