Hello all,
I have a Custom Validator in a datagrid to check the validity of a field in a edititemtemplate. However the error message refuses to display. (Even if I deliberately set IsValid to False as shown below)
I have exactly the same type of custom validator in the footer of the datagrid that is used when adding data and it is working perfectly.
Here is a snippet from the datagrid
and at the moment I just I have
and I cannot the error message to display
Vicky....
"I used to have a handle on life...then it broke
I have a Custom Validator in a datagrid to check the validity of a field in a edititemtemplate. However the error message refuses to display. (Even if I deliberately set IsValid to False as shown below)
I have exactly the same type of custom validator in the footer of the datagrid that is used when adding data and it is working perfectly.
Here is a snippet from the datagrid
Code:
<asp:templatecolumn>
<headertemplate>Unit</headertemplate>
<headerstyle Font-Bold="true" Width="100"></headerstyle>
<itemtemplate><%# DataBinder.Eval(Container.DataItem, "UNIT") %></itemtemplate>
<itemstyle Width="100"></itemstyle>
<edititemtemplate>
<asp:dropdownlist runat="server" id="ddlOutputUnit" CssClass="DDL_STYLE" Width="100" DataValueField="UNIT_ID" DataTextField="UNIT" />
<asp:customvalidator CssClass="ERR_STYLE" id="cvdCompUnitUpdate" runat="server" ErrorMessage="Must use the compulsory unit" ControlToValidate="ddlOutputUnit" Display="Dynamic" OnServerValidate="Test_Valid"/>
</edititemtemplate>
<footertemplate>
<asp:dropdownlist runat="server" id="ddlOutputUnit_add" CssClass="DDL_STYLE" Width="100" DataValueField="UNIT_ID" DataTextField="UNIT"/><br>
<asp:customvalidator CssClass="ERR_STYLE" id="cvdCompUnit" runat="server" ErrorMessage="Must use the compulsory unit" ControlToValidate="ddlOutputUnit_add" Display="Dynamic" OnServerValidate="cvdCompUnit_Validate"/>
</footertemplate>
</asp:templatecolumn>
and at the moment I just I have
Code:
Sub Test_Valid(source as object, args as ServerValidateEventArgs)
args.IsValid = False
End Sub
Vicky....
"I used to have a handle on life...then it broke