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?
