can i use jquery date picker with usercontrol of ASP.Net..?/
i tried but its not working - but i tried with Default.aspx page, its working normal ??
wat should i do to use with Usercontrol.??
can i use jquery date picker with usercontrol of ASP.Net..?/
i tried but its not working - but i tried with Default.aspx page, its working normal ??
wat should i do to use with Usercontrol.??
JQuery controls are fully client side. This means that after the server processes the UserControl, adding it into the Default.aspx page, then the client will just see a single html page with the jQuery markup included.
So in short, yes the jQuery will work with userControls as long as the UserControl is added properly into the page.
Without seeing the code, the best guess I have is that your control's ID isn't correct. Remember that ASP.NET, if you have a server control inside of a user control (or other container-type objects), then the ID that shows up on the page isn't what you put in your markup, but rather a generated unique ID.
So if you're using an <asp:TextBox>, then make sure you're putting the full ID in your javascript, like:
$("#<%= myTextBox.ClientID %>").datepicker();
Rick Strahl made an ASP.Net control basedon the jQuery date picker. You can grab it here
I would use an external .js
file for this, and remove the reliance on IDs or names (which ASP.Net will screw with, in < 4.0 anyway), like this:
In your userControl:
<asp:TextBox ID="anything" CssClass="datepicker" />
In your .js
file, use a class selector instead of the ID, like this:
$(".datepicker").datepicker();
Using a class means one set of code for any number of these datepickers in the page and you don't have to worry about what the IDs are going to look like in the page...they just won't be used for this.