Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Require entry for Calendar control

Reply
Thread Tools

Require entry for Calendar control

 
 
David Thielen
Guest
Posts: n/a
 
      05-28-2006
Hi;

I have:
<asp:Calendar ID="mapCalendarValue" runat="server"
Visible="false"></asp:Calendar>
<asp:RequiredFieldValidator ID="mapCalValidator" runat="server"
ErrorMessage="RequiredFieldValidator"
ControlToValidate="mapCalendarValue"></asp:RequiredFieldValidator>

which gives me:
[HttpException (0x80004005): Control 'mapCalendarValue' referenced by the
ControlToValidate property of 'mapCalValidator' cannot be validated.]

How can I require a selected date in the calendar control?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

 
Reply With Quote
 
 
 
 
David Thielen
Guest
Posts: n/a
 
      05-28-2006
ps - I know that this control defaults to 1/1/1 - I want a validator that
requires a selection other than the default - and if the default changes,
knows that too.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com



"David Thielen" wrote:

> Hi;
>
> I have:
> <asp:Calendar ID="mapCalendarValue" runat="server"
> Visible="false"></asp:Calendar>
> <asp:RequiredFieldValidator ID="mapCalValidator" runat="server"
> ErrorMessage="RequiredFieldValidator"
> ControlToValidate="mapCalendarValue"></asp:RequiredFieldValidator>
>
> which gives me:
> [HttpException (0x80004005): Control 'mapCalendarValue' referenced by the
> ControlToValidate property of 'mapCalValidator' cannot be validated.]
>
> How can I require a selected date in the calendar control?
>
> --
> thanks - dave
> david_at_windward_dot_net
> http://www.windwardreports.com
>

 
Reply With Quote
 
 
 
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      05-29-2006
Hi David,

Thank you for post!

Not all Web form controls can be used in conjunction with the validation
controls. In order to be used with the validation controls, the control
must have a ValidationProperty attribute. The ValidationProperty attribute
tells the validation controls the value to validate against.

The Calendar control is one of the controls that cannot be validated in its
original state. In many cases, however, it is necessary to be able to
validate the user selection in the Calendar control.

There are two solutions to this problem. The first is to write a custom
validation control. The second is to extend the Calendar control so that it
can be used with the built-in validation controls. Following KB article
addresses the second solution:

#How to extend a Web form control to work with the validation controls by
using Visual C#
http://support.microsoft.com/kb/310145


Regards,
Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
swetha
Guest
Posts: n/a
 
      10-03-2010
Hi david ,
I guess u need to ass a text box before ur calender and then take the
control id on text and then validate it !
Regards,
M.Swetha

"David Thielen" wrote:

> Hi;
>
> I have:
> <asp:Calendar ID="mapCalendarValue" runat="server"
> Visible="false"></asp:Calendar>
> <asp:RequiredFieldValidator ID="mapCalValidator" runat="server"
> ErrorMessage="RequiredFieldValidator"
> ControlToValidate="mapCalendarValue"></asp:RequiredFieldValidator>
>
> which gives me:
> [HttpException (0x80004005): Control 'mapCalendarValue' referenced by the
> ControlToValidate property of 'mapCalValidator' cannot be validated.]
>
> How can I require a selected date in the calendar control?
>
> --
> thanks - dave
> david_at_windward_dot_net
> http://www.windwardreports.com
>

 
Reply With Quote
 
swetha
Guest
Posts: n/a
 
      10-03-2010
Hi david ,
I belive u need to take a text box before ur calender and then take the
control id on text and then validate it !
It worked for me
<asp:TextBox ID="txtDate"
runat="server" PropertyName="Text"
Text='<%# Bind("Date") %>'>
</asp:TextBox>

<asp:ImageButton ID="btnDate"
runat="server" OnClick="ClickDate"
ImageUrl="~/Images/Calendar_scheduleHS.png"
/>
<div style ="z-index:2;
position:absolute;top:450px; left:996px;">
<asp:Calendar ID="TodayDate"
OnSelectionChanged="DateEntry" runat="server" BackColor="White"
BorderColor="#3366CC"
BorderWidth="1px" CellPadding="1"
DayNameFormat="Shortest"
Font-Names="Verdana" Font-Size="8pt"
ForeColor="#003399" Height="200px"
Width="220px" Visible="false" DayHeaderStyle-Wrap="true">
<SelectedDayStyle
BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
<SelectorStyle BackColor="#99CCCC"
ForeColor="#336666" />
<WeekendDayStyle
BackColor="#CCCCFF" />
<TodayDayStyle BackColor="#99CCCC"
ForeColor="White" />
<OtherMonthDayStyle
ForeColor="#999999" />
<NextPrevStyle Font-Size="8pt"
ForeColor="#CCCCFF" />
<DayHeaderStyle BackColor="#99CCCC"
ForeColor="#336666" Height="1px" />
<TitleStyle BackColor="#003399"
BorderColor="#3366CC" BorderWidth="1px"
Font-Bold="True" Font-Size="10pt"
ForeColor="#CCCCFF" Height="25px" />
</asp:Calendar>

</div>

<asp:RequiredFieldValidator ID="rfvDate"
runat="server" Text="Please select a
date from the calender menu!"
ControlToValidate="txtDate">
</asp:RequiredFieldValidator><br />
Regards,
M.Swetha

"David Thielen" wrote:

> Hi;
>
> I have:
> <asp:Calendar ID="mapCalendarValue" runat="server"
> Visible="false"></asp:Calendar>
> <asp:RequiredFieldValidator ID="mapCalValidator" runat="server"
> ErrorMessage="RequiredFieldValidator"
> ControlToValidate="mapCalendarValue"></asp:RequiredFieldValidator>
>
> which gives me:
> [HttpException (0x80004005): Control 'mapCalendarValue' referenced by the
> ControlToValidate property of 'mapCalValidator' cannot be validated.]
>
> How can I require a selected date in the calendar control?
>
> --
> thanks - dave
> david_at_windward_dot_net
> http://www.windwardreports.com
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Require text entry - only if radio button checked David Thielen ASP .Net Web Controls 4 08-16-2006 05:51 PM
How to require a calendar entry David Thielen ASP .Net Web Controls 1 05-30-2006 12:22 AM
Calendar control - adding a textbox on each day for data entry Keith-Earl ASP .Net Web Controls 3 10-26-2004 09:49 PM
Calendar Control - Programatically set the calendar to a date range Shevek ASP .Net 3 06-23-2004 01:41 PM
Calendar Control - Programatically set the calendar to a date range Shevek ASP .Net Web Controls 0 06-23-2004 12:06 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57