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

How to make GridTemplateColumn mandatory?

1 Answer 32 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Nathalie asked on 27 Sep 2018, 03:29 PM

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 .

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?

1 Answer, 1 is accepted

Sort by
Dess | Tech Support Engineer, Principal
Telerik team
answered on 28 Sep 2018, 05:16 AM
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.
Asked by
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question