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

Making Radgrid cloumn mandatory where rows are dymanically generated

1 Answer 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Archana
Top achievements
Rank 1
Archana asked on 06 Sep 2011, 01:05 PM

Hi,

Based on radlistbox check changed event i am adding rows in radgrid. My problem is when i add below code on item created event of radgrid then rows will not be added  or deleted to radgrid.

protected void rgSupportingDocumentation_ItemCreated(object sender, GridItemEventArgs e)
      {
           if (e.Item is GridEditableItem && e.Item.IsInEditMode)
           {
               GridEditableItem editItem = (GridEditableItem)e.Item;
               TextBox txtbx = (TextBox)editItem["DocId"].Controls[0];
               txtbx.ID = "TextValidated";

               RequiredFieldValidator reqfdvalidtr = new RequiredFieldValidator();
               reqfdvalidtr.ID = "RequiredFieldValidator1";
               reqfdvalidtr.ErrorMessage = "RequiredField";
               reqfdvalidtr.ControlToValidate = "TextValidated";
               editItem["DocId"].Width = Unit.Pixel(100);
               editItem["DocId"].Controls.Add(reqfdvalidtr);

           }

Please revert soon if someone have some solution.
Thanks,

1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 08 Sep 2011, 12:50 PM
Hello Archana,

The provided information is not enough for us to fully understand your scenario. How is the grid data-bound? How do you add the rows to the grid?
The code you posted is for adding a required field validator in the edit form of the grid and should not affect the programmatic adding and deleting of records in the datasource.

Please provide the requested information and we will do our best to help you.
Sending us a sample project will be highly appreciated.

Best wishes,
Mira
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Grid
Asked by
Archana
Top achievements
Rank 1
Answers by
Mira
Telerik team
Share this question
or