Hi
I have an ASP.NET page containing a RADGrid with an EditFormTemplate. In the UpdateCommand of the grid I do some validation stuff and I would like to assign a CssClass to all the fields of the EditFormTemplate containing invalid values.
The validation is working properly. However, I can't manage to assign the CssClass to the controls. My UpdateCommand reads as follows:
The CSS file contains the following definition for the class MandatoryField:
After exiting the UpdateCommand function, the page is reloaded but the CssClass is not set to the fields in question. How can I achieve a visual marking of the fields with invalid values?
Kind regards
Jürg
I have an ASP.NET page containing a RADGrid with an EditFormTemplate. In the UpdateCommand of the grid I do some validation stuff and I would like to assign a CssClass to all the fields of the EditFormTemplate containing invalid values.
The validation is working properly. However, I can't manage to assign the CssClass to the controls. My UpdateCommand reads as follows:
Protected Sub CompanyGrid_UpdateCommand(sender As Object, e As GridCommandEventArgs) Handles CompanyGrid.UpdateCommand Dim objEditedItem As GridEditableItem = CType(e.Item, GridEditableItem) Dim objTextBox As RadTextBox objTextBox = CType(objEditedItem.FindControl("txtCompanyname"), RadTextBox) If objTextBox.Text.Trim() = "" Then objTextBox.CssClass = "MandatoryField" e.Canceled = True Exit Sub End IfEnd SubThe CSS file contains the following definition for the class MandatoryField:
.MandatoryField{ margin-left: 0em; border:1px solid #397D47; background-color:#F77A80; font-size: 1.0em;}After exiting the UpdateCommand function, the page is reloaded but the CssClass is not set to the fields in question. How can I achieve a visual marking of the fields with invalid values?
Kind regards
Jürg