Click here to Skip to main content
12,065,756 members (31,607 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET C#4.0
how to validate calendar extender on a textbox...it has to take only date i have use filtered control and gave valid char as no's only...it is working fine but if we press no's in that text box it is taking i have to avoid that and it has to allow only date to be selected from that calendar...pls reply
Posted 21-Feb-12 18:36pm
Kiirrii559
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

try this:-

There is a soluton that works across the browsers. Put
onKeyPress = "javascript: return false;" onPaste = "javascript: return false;"
in your textbox. That way, even the textbox is enabled, the user will not be able to modify the data.

Please refer the links for more details:-

http://forums.asp.net/t/1117573.aspx[^]

http://forums.asp.net/t/1033596.aspx[^]

http://stackoverflow.com/questions/3005425/how-to-check-or-validate-the-textbox-entered-date-is-in-dd-mm-yyyy-format[^]

I hope this will help you out.

Thanks
  Permalink  
Comments
Kiirrii 22-Feb-12 0:08am
   
onKeyPress = "javascript: return false;"
sweet and simple thanks...
Varun Sareen 22-Feb-12 0:09am
   
your welcome dear
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Dear disable the textbox so that nobody can access textbox
  Permalink  
Comments
Kiirrii 21-Feb-12 23:45pm
   
if u make it as disable calender wil not come....
ashumeerut 12-Aug-13 1:52am
   
backspace is working, problem
Varun Sareen 21-Feb-12 23:58pm
   
absolutely right
Kiirrii 21-Feb-12 23:48pm
   
Used Calender Extender dude on that textbox disable not works..
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Hi,

I think you should set your textboxt to read only mode....
If you are using ajax toolkit then...

See this sample code:

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<td align="left">
   Admission Date:
</td>

Please do not forget to vote if could help...
  Permalink  
v3
Comments
sofia3 4-Jun-12 9:20am
   
if you will do read only textbox value will be empty on code behind it will not set no matter in frontend it will be displayed.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

Hi there,
If you are using ajax calender extender then use this:

<asp:TextBox CssClass="controls" ID="txtPOITo" runat="server" Width="125px" ReadOnly="True" />
<asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/Images/Calendar_scheduleHS.png"/>
<cc1:CalendarExtender ID="CalendarExtender2" TargetControlID="txtPOITo" Animated="true"
PopupButtonID="ImageButton2" Format="dd/MM/yyyy" PopupPosition="BottomRight" runat="server">
</cc1:CalendarExtender>
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160207.1 | Last Updated 22 Feb 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100