How to calender extender for requiredfieldvalidator

Posted by Jayakumars under ASP.NET on 9/9/2011 | Points: 10 | Views : 5810 | Status : [Member] [MVP] | Replies : 4
hi
How to use CalendarExtender for requiredfieldvalidator also dd/mm/yyyy format only allow
donot allow characters how will do this

Mark as Answer if its helpful to you


Responses

Posted by: Karthick on: 9/11/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Jayakumar,

this is posible if you think out of box. Please use textbox control and extend the calander control on it. use javascript for restricting special character entering. use Format property in CalanderExtender control as "dd/MM/yyyy". Thats all

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Blessyjees on: 9/22/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi,

You can set date value into textbox using ajax calendar extender and set required fields validator for this textbox control.
<asp:RequiredFieldValidator ID="reqValLName" runat="server" 

ControlToValidate="txtStartDate" ErrorMessage="*" SetFocusOnError="true" ToolTip="Date is required">
<asp:TextBox ID="txtStartDate" runat="server" SkinID="Date"></asp:TextBox>
<img id="imgStartDate" alt="Click to show calendar"
src='<%=Page.ResolveUrl("~/App_Themes/Default/Images/datepic.jpg")%>'
style=" vertical-align:middle;cursor:pointer;" title="Click to show calendar" />
<ajaxToolkit:CalendarExtender ID="calendarFromDate" runat="server"
CssClass="MyCalendar" PopupButtonID="imgStartDate"
TargetControlID="txtStartDate" Format="dd/mm/yyyy"/>


Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 9/22/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

Blessyjees post your clearly some code missing or attach zip format.

Mark as Answer if its helpful to you

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ndebata on: 9/22/2011 [Member] Starter | Points: 25

Up
0
Down
<asp:TextBox ID="txtCal" Width="100" runat="server"  EnableViewState="true"></asp:TextBox>

<asp:ImageButton ID="ImageButton1" runat="server" OnClick="LinkButton1_Click" ToolTip="Select Date" ImageUrl="~/images/calendar_icon.gif"
CausesValidation="false"></asp:ImageButton>
<asp:CalendarExtender DefaultView="Days" Animated="true" ID="CalendarExtender1"
Format="dd/MM/yyyy" runat="server" TargetControlID="txtCal" PopupButtonID="ImageButton1">
</asp:CalendarExtender>
<asp:RangeValidator ID="rangeValDate" Type="Date" ControlToValidate="txtCal" MaximumValue="31/12/9998"
MinimumValue="1/1/1753" runat="server">*</asp:RangeValidator>
<asp:RequiredFieldValidator ID="reqValDate" runat="server" ControlToValidate="txtCal" ErrorMessage="*"></asp:RequiredFieldValidator>



Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response