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

How to make GridTemplateColumn mandatory?

1 Answer 32 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Nathalie
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="">
<ColumnValidationSettings>
<RequiredFieldValidator ForeColor=""></RequiredFieldValidator>
</ColumnValidationSettings>
</sq8:GridBoundColumn>

 

And I can use this Validator for the TextBox:

<sq8:Label runat="server" Text="Field:" ID="Label1" Width="100%"></sq8:Label>
<nobr>
<sq8:TextBox runat="server" ID="txtField" Width="100%"></sq8:TextBox>
<sq8:RequiredFieldValidator runat="server" ErrorMessage="RequiredFieldValidator" ID="RequiredFieldValidator4" ControlToValidate="txtField" SetFocusOnError="True">*</sq8:RequiredFieldValidator>
</nobr>
<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:

<Columns>
<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>
</sq8:GridBoundColumn>
</Columns>

 

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
0
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: https://www.telerik.com/forums Thus, our community will gladly assist you.

I hope this information helps.

Regards,
Dess
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.
Tags
GridView
Asked by
Nathalie
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or