I have question that I have not been able to figure out, I have grid that displays records and also the "Add new record" button & buttonLink. when the grid is in edit mode and the elements for the new record are displayed I have a drop down with values and some static text fields and a dynamic text field that is displayed if a specific value in the drop down is chosen. the dynamic text field also has an ASP RequiredFieldValidator
in the grid_ItemCommand() method I would like to do some additional validation and make the dynamic text field and it's vaidator appear, and the edit screen stay active with it's current values in place.
I'm new to RadGrid and not sure how to properly leave the grid in edit mode and have all the fields appear that I would Like and the associated data too. here is the snippet of code that have just trying to get the dynamic text field and the validator to appear
specCert = value from the dropdown
specOther = value from the dynamic text field that should have appeared and required being populated.
txtSpecOther = id of the dynamic text field
rfvOther = id of the RequiredFieldValidator
if ((specCert.Equals("370")) && (String.IsNullOrEmpty(specOther)))
{
//Get the currently open item's entries and assign them to the Add New Record form's fields
GridEditableItem insertedItem = e.Item.OwnerTableView.GetInsertItem();
String ucID = GridEditFormItem.EditFormUserControlID;
UserControl i_uc = insertedItem.FindControl(ucID) as UserControl;
((TextBox)i_uc.FindControl("txtSpecOther")).Visible = true;
((RequiredFieldValidator)i_uc.FindControl("rfvOther")).Visible = true;
// show the validation error message
((RequiredFieldValidator)i_uc.FindControl("rfvOther")).IsValid = false;
return;
}
//other code that I dont want to run
......
......
......
......
//other code that I dont want to run
thank you for any help I can get.
in the grid_ItemCommand() method I would like to do some additional validation and make the dynamic text field and it's vaidator appear, and the edit screen stay active with it's current values in place.
I'm new to RadGrid and not sure how to properly leave the grid in edit mode and have all the fields appear that I would Like and the associated data too. here is the snippet of code that have just trying to get the dynamic text field and the validator to appear
specCert = value from the dropdown
specOther = value from the dynamic text field that should have appeared and required being populated.
txtSpecOther = id of the dynamic text field
rfvOther = id of the RequiredFieldValidator
if ((specCert.Equals("370")) && (String.IsNullOrEmpty(specOther)))
{
//Get the currently open item's entries and assign them to the Add New Record form's fields
GridEditableItem insertedItem = e.Item.OwnerTableView.GetInsertItem();
String ucID = GridEditFormItem.EditFormUserControlID;
UserControl i_uc = insertedItem.FindControl(ucID) as UserControl;
((TextBox)i_uc.FindControl("txtSpecOther")).Visible = true;
((RequiredFieldValidator)i_uc.FindControl("rfvOther")).Visible = true;
// show the validation error message
((RequiredFieldValidator)i_uc.FindControl("rfvOther")).IsValid = false;
return;
}
//other code that I dont want to run
......
......
......
......
//other code that I dont want to run
thank you for any help I can get.