Hi ,
I am using edit and insert template to display grid items in edit mode. I have several comboboxes in edittemplate and would like to have customvalidator that runs on client side.
If tselected index of the combobox is "0" then it should not let user insert/edit a record. Code shown below doesnot work at all times, especially when I have multiple comboboxes.
Javascript fxn
function ValidateComboBoxInNGGridEditForm(customValidator, arguments) {
if (arguments.Value == "< Select a Value >") {
arguments.IsValid = false;
} else {
arguments.IsValid = true;
}
}
c# Code
case "REQCOMBOBOX":
RadComboBox comboBox = new RadComboBox();
comboBox.Width = new Unit(215.0, UnitType.Pixel);
.....................
comboBox.SelectedIndex = -1;
CustomValidator customValidator = new CustomValidator();
customValidator.ID = comboBox.ID + "REQFVLD";
customValidator.ControlToValidate = comboBox.ID;
customValidator.ClientValidationFunction = "ValidateComboBoxInNGGridEditForm" ;
customValidator.ErrorMessage = " *";
Am I missing anything here?
Thanks,
Prava
I am using edit and insert template to display grid items in edit mode. I have several comboboxes in edittemplate and would like to have customvalidator that runs on client side.
If tselected index of the combobox is "0" then it should not let user insert/edit a record. Code shown below doesnot work at all times, especially when I have multiple comboboxes.
Javascript fxn
function ValidateComboBoxInNGGridEditForm(customValidator, arguments) {
if (arguments.Value == "< Select a Value >") {
arguments.IsValid = false;
} else {
arguments.IsValid = true;
}
}
c# Code
case "REQCOMBOBOX":
RadComboBox comboBox = new RadComboBox();
comboBox.Width = new Unit(215.0, UnitType.Pixel);
.....................
comboBox.SelectedIndex = -1;
CustomValidator customValidator = new CustomValidator();
customValidator.ID = comboBox.ID + "REQFVLD";
customValidator.ControlToValidate = comboBox.ID;
customValidator.ClientValidationFunction = "ValidateComboBoxInNGGridEditForm" ;
customValidator.ErrorMessage = " *";
Am I missing anything here?
Thanks,
Prava