Click here to Skip to main content
15,921,941 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
how to disable the calenderextender if the textbox is disabled.
suppose if consider the following code,
ASP.NET
<asp:TextBox ID="txtstartdate" runat="server"></asp:TextBox>
<asp:CalendarExtender ID="txtstartdate_CalendarExtender" runat="server" Enabled="True"
TargetControlID="txtstartdate" Format="dd/MM/yyyy" DefaultView="Years" BehaviorID="StartDate">

if the textbox is enable user can pick the date..if it is disable then user should not be allowed to pick the date.."using javascript or jquery"
Posted
Updated 4-Aug-14 1:14am
v2

Set txtstartdate_CalendarExtender.Enabled=false; from code behind.
 
Share this answer
 
v2
Comments
[no name] 4-Aug-14 7:11am    
thanx but i want to do it using javascript or jquery
Strikerzz Arut 4-Aug-14 7:15am    
use :
function(){
$('#txtstartdate_CalendarExtender').attr('disabled',true);
}
Else frame it using a function name.Include jquery plugin before doing this.
Hi, Please try this and let me know

C#
function validate_calendar() {
var textbox = document.getgetElementById("your_textbox_id");
var cal_extender = document.getgetElementById("your_calendarExtendor_id")
if(textbox.disabled)
{
    cal_extender.disabled = true;
}

if(!textbox.disabled)
{
    cal_extender.disabled = false;
}
}
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900