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

[Solved] Required Field Validator on GridTextBoxColumnEditor

3 Answers 159 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Josh Winkler
Top achievements
Rank 1
Josh Winkler asked on 22 Jan 2010, 08:24 PM
I have seen the examples for putting a required field validator on textboxes but the same convention does not work for the dropdowns. Here is what we have and we need to get this to work with the dropdown. There isnt a DropDownControl for us to use this with a dropdown as there is with a textbox.

Dim

 

Service As GridTextBoxColumnEditor = CType(item.EditManager.GetColumnEditor("Service"), GridTextBoxColumnEditor)

 

 

Dim YCell As TableCell = CType(Service.TextBoxControl.Parent, TableCell)

 

 

Dim rfv1 As New RequiredFieldValidator()

 

Service.TextBoxControl.ID =

"Service"

 

rfv1.ControlToValidate = Service.TextBoxControl.ID

rfv1.ErrorMessage =

"Please select a Service"

 

YCell.Controls.Add(rfv1)

http://www.telerik.com/help/aspnet-ajax/grdvalidation.html (taken from here)

Please let us know what the solution would be for this scenario to change the code above from a textbox to a dropdown. Thanks.

3 Answers, 1 is accepted

Sort by
0
Josh Winkler
Top achievements
Rank 1
answered on 26 Jan 2010, 02:43 PM
Can we get an answer on this issue please?
0
Josh Winkler
Top achievements
Rank 1
answered on 27 Jan 2010, 08:10 PM
Any updates on this yet? Please let us know as soon as possible we have a client waiting. Thanks.
0
Yavor
Telerik team
answered on 28 Jan 2010, 06:37 AM
Hello Josh,

The best option in this case would be to reference the edit form, and add the validator directly. More information on this option is available in the following article:

http://www.telerik.com/help/aspnet-ajax/grdaccessingcellsandrows.html

You can couple the code in the first section, with code which checks if the item is in edit mode (&& e.Item.IsInEditMode).
 I hope this gets you started properly.

Best wishes,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Josh Winkler
Top achievements
Rank 1
Answers by
Josh Winkler
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or