Home > AJAX, ASP.Net, Javascript > Allow User to Select only First day of month in AJAX Calender

Allow User to Select only First day of month in AJAX Calender


Hi all,

try this example to Allow User to Select only First day of month in AJAX Calender

1) Open VS2008 and create a new website

2) Add New Web Page and from Toolbox drag ScriptManager , TextBox and AJAX Calender Controls

3) Add This Javascript function


<script language="javascript" type="text/javascript">
 function CheckDate(sender, args) {
 alert(sender._selectedDate.getDate());
 if (sender._selectedDate.getDate() != 1) {
 alert("Only first date are allowed.");
 // Cancel selected the date
 sender._textbox.set_Value("")
 }
 }
</script>

4) Your Page will be like that


<div>
 Select Date :
 <asp:TextBox ID="txt_Date" runat="server"></asp:TextBox>
 <cc1:CalendarExtender ID="txt_Date_CalendarExtender" runat="server"
 Enabled="True" TargetControlID="txt_Date" OnClientDateSelectionChanged="CheckDate">
 </cc1:CalendarExtender>
</div>

Hope this helps

Good Luck

Advertisements
Categories: AJAX, ASP.Net, Javascript
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: