|
Rank: Newbie Groups: Member
Joined: 5/5/2008 Posts: 9
|
I am trying to add requiredfiledvalidator to date picker, however when I set ControlToValidate property of requiredfiledvalidator it doesn't seem to work with eo web date picker, how can I make this control a required filed?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Hi,
The DatePicker does work with RequiredFieldValidator. We verified that with a simple test page with a DatePicker, a RequiredFieldValidator and a Button. Can you try the same and see if it works? Make sure you have the latest version.
Thanks
|
|
Rank: Member Groups: Member
Joined: 4/18/2008 Posts: 19
|
When the DatePicker control and the ASP RequiredFiledValidator are in the same web user control (.ascx), the validation works. However, if you put the web user control that contains the DatePicker in a .aspx page and have the RequiredFiledValidator on the .aspx page as well then a runtime exception is raised during the loading of the page.
Code example:
in a .aspx if you have a web user control and the req field validator, an exception occurs: <tr> <td> <syn:DatePicker ID="xxxDatePicker" Runat="server"/> </td> <td> <asp:RequiredFieldValidator ID="xxxxRequiredFieldValidator" ControlToValidate="xxxDatePicker" Display="Static" Enabled="true" ErrorMessage="xxxxxx" runat="server"> </asp:RequiredFieldValidator> </td> </tr>
meanwhile, if the required field validator is in the web user control it works fine.
I would like to be able to have the validator outside of the control
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
James Gemma wrote:However, if you put the web user control that contains the DatePicker in a .aspx page and have the RequiredFiledValidator on the .aspx page as well then a runtime exception is raised during the loading of the page.
I believe that is very normal. You would get the same error if you were to use the standard ASP.NET TextBox. Basically the validator only works with controls that are within the same naming container. Technically it is possible to make it to work on other scenario as well, but in our opinion it would make much more sense to have our controls to be consistent with standard ASP.NET.
|
|