This is a migrated thread and some comments may be shown as answers.

Inline Validation As Popup

1 Answer 68 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Amitkumar
Top achievements
Rank 1
Amitkumar asked on 05 Jan 2010, 11:12 AM
hi
  RequiredFieldValidator validator = new RequiredFieldValidator();
                editor.TextBoxControl.ID = "GridTextBoxRoleName";
                validator.ControlToValidate = editor.TextBoxControl.ID;
                validator.ErrorMessage = "Enter Role Name";
                validator.SetFocusOnError = true;
               cell.Controls.Add(validator);

but i want to popup insted of writing in inline how can i do i m writing this code in grid1_ItemCreated(object sender, GridItemEventArgs e)


thank you

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 05 Jan 2010, 12:02 PM
Hello Amit,

You can add a validationsummary control and pop up the error message. Check out the following code to get this done:
c#:
            RequiredFieldValidator validator = new RequiredFieldValidator(); 
            editor.TextBoxControl.ID = "GridTextBoxRoleName"
            validator.ControlToValidate = editor.TextBoxControl.ID; 
            validator.ErrorMessage = "Enter Role Name"
            validator.SetFocusOnError = true
            validator.Display = ValidatorDisplay.None; 
            ValidationSummary validationsum = new ValidationSummary(); 
            validationsum.ID = "ValidationSummary1"
            validationsum.ShowMessageBox = true
            validationsum.ShowSummary = false
            validationsum.DisplayMode = ValidationSummaryDisplayMode.SingleParagraph; 
            cell.Controls.Add(validator); 
            cell.Controls.Add(validationsum); 

Thanks
Princy.
Tags
Grid
Asked by
Amitkumar
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or