I have used jquery datepicker in my .aspx page. The control is working fine. What i need is to disable the control if the textbox on which it is linked is disabled. For ex. I am showing datepicker on textbox "txtDateOfAssignment". If the Enabled property of this textbox is false then datepicker should not be active on that.
Anybody have an idea?
Thanks in advance.
if you look at the documentation you'll notice that there is a "disable" method, so you can do :
$('id-of-your-textbox').datepicker('disable');
Ok, finally you're not using jquery-UI but jquery-datepicker, so it should be more something like as referred to the documentation here
$(document).ready(function () {
$('.date-picker').dpSetDisabled(true);
});
If you want to disable only 1 datepicker dont use the class selector ".date-picker" but the id of the datepicker you want to disable.
Another possible Solution is
var j$=jQuery.noConflict();
j$("#inputTextID").datepicker(('disable' ));
j$("#inputTextID").datepicker(('enable' ));
Related
Yet another question about the angular calendar directive. I need to display multiple calendars on one page and am using the jquery tabs widget. However, only one calendar will render properly. In normal jquery fullCalendar, you use the 'render' method to ensure that the calendar shows when the tab is selected. However, this doesn't seem to be working with the angular-ui calendar directive.
Here is a plunker showing what I mean. Delete the $().tabs() and the three angular calendars display just fine. Wrap them in tabs, and it no longer works:
http://plnkr.co/edit/HEEX4iqb8kFAsjwdGmkM
Any ideas on why this is not working and how to fix it?
Thanks!
PS. I will cross-post this question in Google Groups. Thanks.
It appears that despite the fullCalendar documentation, "show" is not the place to trigger a fullcalendar('render'). I should say, at least not when working with Angular. I don't know if that is correct under normal jQuery usage. Use the "Activate" event instead:
$("#tabs").tabs({
activate: function(){
("#calendar").fullCalendar('render');
}
});
http://plnkr.co/edit/HEEX4iqb8kFAsjwdGmkM
Use timeout while rendering.
<tab heading="{{tabs[0].title}}" active="tabs[0].active" select="renderCalendar()" disabled="tabs[0].disabled">
$scope.renderCalendar = function() {
$timeout(function(){
$('.calendar').fullCalendar('render');
}, 0);
};
I have a system and I had a problem today, when the user double-click on button control and the system process the operation twice.
I found a solution with this code on the button:
OnClientClick = "this.disabled = true; this.value = 'submiting ...';" UseSubmitBehavior = "false"
However, I have several pages in the system, with several buttons ... is there any way to set these attributes to all the buttons of the application?
Thank you!
What about using a clientSide approach by using JQuery and disabling all Submit controls (jsfiddle)
$(document).ready(function () {
$(' :submit').click(function (event) {
$(this).attr("disabled","true");
});
});
I am quite new to JQuery so if there are any better solutions or I am completly wrong, pls let me know!
I'm not sure, but it seems that it is possible through skin file.
You can create a custom button. Here you have example how to create button that displays confirm window on client click. Almost what you wan't.
http://dhavalupadhyaya.wordpress.com/2008/07/20/creating-custom-controls-in-asp-net/
Than you would have to change all the asp:Buttons on every page to someTag:YourButton. Maybe simple Find/Replace. But I think there is possibility to configure in web.config so that ASP.NET uses someTag:YourButton everytime it sees asp:Button. But can't find now how to do it.
How can i trigger clicking of the "today" button by code in FullCalendar? If I where to this by an external button?
http://arshaw.com/fullcalendar/docs/current_date/today/
You have access to fullCalendar, so you can do something like this:
$('#external-button').on('click', function() {
$('#calendar').fullCalendar('today');
});
Without actually looking at the code, I would assume that the "Today" button is hooked to a JQuery or Javascript method within the FullCalendar code. Just call that method.
In case the documentation URL posted above goes dead...
Moves the calendar to the current date.
.fullCalendar( 'today' )
Example using today with an external button:
$('#my-today-button').click(function() {
$('#calendar').fullCalendar('today');
});
How to disable the asp.net Link buttons and asp.net radio buttons.
I have used
to enable
$("#sLbtnFirst").attr("disabled", "");
to disable
$("#sLbtnFirst").attr("disabled", "disabled");
but i'm able to click the buttons they are just greying
In .NET radio buttons, the attribute that specifies whether they're clickable is called "enabled", not "disabled".
But, at client-side they are rendered as html input tags which do contain the attribute "disabled" so to disable them you would want to use:
$("#sRbtnFirst").attr("disabled", "disabled");
To enable:
$("#sRbtnFirst").removeAttr("disabled");
EDIT: I've tried your jQuery myself in a .NET app and it seems to grey out the radio buttons fine (and prevent clicking). The LinkButton's a different story though.
You'll also need to remove the "href" attribute to prevent it from performing an action on click. So:
$("#sLbtnFirst").attr("disabled", "disabled");
$("#sLbtnFirst").removeAttr("href");
That should disable the LinkButton.
Also, remember that your IDs will change when they are rendered in the form so they won't be what they are when you view your aspx page in Visual Studio. .NET will change them into something like:
#ct100_sLbtnFirst
Link buttons render as anchor tags (<a href=) and the disabled attribute is not defined for this tag. As far as radio buttons are concerned you could apply the disabled attribute to them, they will grey out and their value won't be sent when you post the form.
To enable/disable linkbutton, try this:
//disabling
document.getElementById('sLbtnFirst').onclick = function() {return false;}
//enabling
document.getElementById('sLbtnFirst').onclick = function() {return true;}
You should use:
$("#sRbtnFirst").removeAttr("disabled");
Is there a way to hide radio buttons inside a RadioButtonList control programmatically?
Under the hood, you can access the attributes of the item and assign it a CSS style.
So you should be able to then programmatically assign it by specifying:
RadioButtonList.Items(1).CssClass.Add("visibility", "hidden")
and get the job done.
Here's how you have to apply a style attribute to a listitem:
RadioButtonList.Items(1).Attributes.Add("style", "display:none")
- OR -
RadioButtonList.Items(1).Attributes.Add("style", "visibility:hidden")
Why not add and remove the radio buttons as needed?
RadioButtonList.Items.Add("Item Name" or index);
RadioButtonList.Items.Remove("Item Name" or index);
Try This:
RadioButtonList.Items.Remove(RadioButtonList.Items.FindByValue("3"));
If you mean with JavaScript, and if I remember correctly, you've got to dig out the ClientID properties of each <input type="radio" ...> tag.
Have you tried to hide it through the itemdatabound event onload or do you need it to hide after it loads?
I haven't tested it, but I'd assume (for C#)
foreach(ListItem myItem in rbl.Items)
{
if(whatever condition)
myItem.Attributes.Add("visibility","hidden");
}
Another answer to not visibility inside a RadioButtonList.
Try this code:
RadioButtonList.Items(1).CssClass.Add("display", "none");
and get the job to no display RadioButtonList in layout.