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

Related RadComboBoxes - Submitting and Validation problems

2 Answers 72 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Bader
Top achievements
Rank 1
Bader asked on 12 Jan 2012, 10:26 AM

Hi,

I'm trying to validate one of a related radcombobox controls, but there is few problems (Please view the sample application):
1) In the usercontrol there is in addition to the radcombobox controls, a RadUpload control which must be validated too (Check size of an image).  So by addding a custom validator to the usercontrol, the related combobox (in the screen-shot) doesn't load the items and allways displays "Loading...".
But by removing the customvalidator control (Or even by removeing the "OnServerValidate="ImgRadUploadDimCustomValidator_ServerValidate"" property), then the related radcombobox loads all required items.

2) As it is known, the related combobox shows items by selecting the required item in the source combobox. So, I'm trying to set a Comparevalidator (Called "ParentIDCompareValidator") to the related comboboX (Which has a "Select Parent" item - default item).So By selecting the "Select Parent" item the validation message must be displayed.
I don't know how can I set a comparevalidator in order to enable it validate the selected item when the required items are loaded. Please try to enable the "ParentIDCompareValidator" control and you will see that the error message is allways displayed.

3) By clicking insert/Edit buttons, Only the default item value saved in the database, and not the selected item. Thats mean, if I select any item (except to the default item) and click submit, then the default item value ("1") saved on the DB.

Please, I need your help in order to solve the above problems.

Regards,
Bader

2 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 20 Jan 2012, 02:13 PM
Hi Bader,

1) This is probably caused by improper definition of which controls should invoke validation and which should not. If you need only the buttons to fire validation, make sure you've set the CausesValidation property for the rest of the controls, like comboboxes to false.
2) CompareValidator is not the most suitable one here. You would better use custom validator again.
3) If the combobox items are loaded on demand, then to extract the new value try using the Text property, instead of getting the SelectedValue.

Greetings,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Bader
Top achievements
Rank 1
answered on 24 Jan 2012, 11:17 AM
Hi,

Thank you very much for your reply.

1) Regarding the first point, as I mentioned in my first post the OnServerValidate property of  the custom validator causes the problem (The related combobox doesn't load its items and allways shows "Loading.."). And the custom validator control doens't have CausesValidation property.

Regarding the other problems, they me be caused because of the above problem.

2) I noticed that by clicking the Edit link the entire page PostBacks (Because the ajax is disabled when it is needed to upload files using RadGrid EditForm) . How can I solve this issue ?

Please, I need your help in solving the above problems (Please download the sample project).

Regards,
Bader
Tags
ComboBox
Asked by
Bader
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Bader
Top achievements
Rank 1
Share this question
or