.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

jquery datepicker not working in dialog

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :ASP.Net


I have an ajax call that opens a dialog that contains a datepicker. The call looks like this:

            type: "GET",
            url: encodeURI('<%: Url.Action("action", "controller") %>'),
            cache: false,
            dataType: 'html',
            error: function (XMLHttpRequest, textStatus, errorThrown) { $("#dialog").html(errorThrown); },
            success: function (data, textStatus, XMLHttpRequest) {
            complete: function (XMLHttpRequest, textStatus) {

function openCalendar() {
        $('#EndDate').live('click', function () {
            $(this, document).datepicker({ showOn: 'both' }).focus();

The picker opens ok on click but when I try to select some day it won't set the day in the input field and it won't close also.

Thank you in advance

View Complete Post

More Related Resource Links

ASP.NET GridView - edit records using JQuery Dialog

There are many ways in which you could modify modular data in Grid View:
1. Inline by making rows editable when u click on Edit
2. By using separate pages for Edit
3. By using popups/dialogs for adding/editing

JQuery Treeview plugin is not working with Ajax page load in ie8


Hi there,

I developed a page where i m using jquery treeview plugin to generate tree. It worked fine on FF, IE8 with out ajax.

But when my page loads thro' ajax call in IE8, it is not collapsing or expanding tree.

Any idea?

Thanks in advance.

jquery confirm windows isn't working


Hi, i am using jquery to implement a modal confirm windows but it not working

i have a template field button with ajax confirm using jquery but i have a problem. Apper the confirm windows but when i click on "yes" doesn't execute the delete command. without ajax (using template field button and simple confirm windows javascript) works so well.

Can you give me a hand with this?

thx in advance!

<link href="_assets/css/StyleSheet.css" rel="stylesheet" type="text/css" />
<link href="_assets/css/confirm.css" rel="stylesheet" type="text/css" />
<script src="_assets/js/jquery-1.2.6.min.js" type="text/javascript"></script>
<script src="_assets/js/jquery.simplemodal-1.1.1.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function() {
       $(".deleteCustomer").click(function(ev) {
                var msg = $(this).attr("title");
                confirm(msg + "?");

jquery datepicker not popping up in Gridview Edit Template textbox


I have a gridview that I can't for the life of me get the datepicker calender to pop up for.  I've been using the datepicker for months very successfully for a variety of textboxes on the page and inside of formviews but this is the first time I've tried using with gridview.  I didn't expect any issues however can't seem to find anything to work.  I have searched the forums for 2 days and attempted any suggestions found within the solutions to no avail.  I've tried using the CSS to link the datepicker but everything stopped working when I changed the code and my page which uses a css style already got all distorted looking.  Please help!

Here is my gridview (only included a part b/c it is large and am only having problem with the datepicker for the date completed text box)

<asp:GridView ID="GridViewCompleted" runat="server" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid"
        BorderWidth="3px" CellPadding="4" DataKeyNames="job_id" DataSourceID="SourceJobProjectCompleted"
        ForeColor="Black" CellSpacing="2">

Size of jQuery datepicker popup


I have several mvc applications all using the jquery datepicker. One of them the popup appears double size (height and width), obvously it's something I've inadvertantly changed, probably in the css, but I can't figure out what it is. I have tried/applied a few themes and css/site master from the mvc code templates on codeplex, but I just can't figure out what did this one.

Any ideas ?

(MVC & jQuery) Can't Add Datepicker to List of form elements



I'm still relatively new to jQuery (mostly finding things I need online and making simple changes). I have the following piece of code in my MVC app to render a partial view

<% int i = 0;
   foreach (var item in Model) { %>

        <td valign="top" style="border: none;">
            <%= Html.TextBox("MeetingList[" + i + "].Start", String.Format("{0:MM/dd/yyyy HH:mm}", item.Start), new { @style = "width: 120px;", @class="start" })%>
        <td valign="top" style="border: none;">
            <%= Html.TextBox("MeetingList[" + i + "].End", String.Format("{0:MM/dd/yyyy HH:mm}", item.End), new { @style = "width: 120px;", @class = "end" })%>

And I've tried the following to grab each of those 'MeetingList[...' items and add a datepicker to them,

        $(".start").each(function(index) {
            var $temp = $('#MeetingList[' + index + '].Start');
}); });


Refreshing a Jquery modal dialog after closing another Jquery modal dialog


I have one aspx page which contains a webpart. The structure of the webpart is:

Webpart(holds one user control say UC1)

      UC1-> contains another user control say (UC2) in a <div>, which I am going to show as a popup on clicking of a link button inside a gridview in UC1.

      UC2-> contain another user control say (UC3) in a <div>, which I am going to show as a popup on clicking of a button inside in UC2.

That means -> UC1(main page) ------->(Onclick) One JQuery popup(UC2)--------------->(OnClick) One Jquery popup(UC3) here UC2 is still remaining in focus and UC3 will be another Jquery popup on UC2.

Now my requirement is when i fill the Jquery popup(UC3) and click on save button in UC3, I would like to close UC3 Jquery popup and refresh the gridview inside UC2 Jquery popup without closing it.

Is this possible?(please explain the logic if found in terms of Jquery, but not in terms of normal popup windows)

Working with datepicker and input controls


Helloe all,

Please I'm developing a hotel reservation system and I have both "check in" and "check out" html "input"controls and I have linked these controls to the Jquery datepicker. Unfortunately, I'm not able to access the value of the controls in asp code behind (using their ids CheckInDate and CheckOutDate respectively).

Previously, I used asp textboxes and I was able to access the IDs in code behind but whenever the page displays and I click in any of the textboxes their respective datepicker don't show.

However, I'm able to access the html input controls in code behind when I add runat="server" but when I do that the datepicker don't show for both control when I click in the input boxes.

Someone help me so that I will be able to make the datepicker show as well as fetching/accessing the value of the input boxes (selected dates) in the code behind...... or how to use asp controls and add onclick functions to call the datepicker.

Thank you.


<script type="text/javascript">
        $(function() {       
        $("#CheckInDate").datepicker({ minDate: 0, maxDate: '+1M' });

Need urgent help using JQuery DatePicker inside asp.net user control

Hello,I am able to use the DatePicker inside an aspx page with no problem at all but when I try to use that inside a usercontrol it gives me an error "Object expected"I have the links to my Jquery css and script files from the master page and have the following code inside a usercontrol:<script type="text/javascript"><!--    $(document).ready(function() {    var txt1 = document.getElementById('<%= txtDate.ClientID %>');    $(txt1).datepicker({ dateFormat: 'dd/mm/yy', duration: ''   });    });          // --></script><asp:TextBox ID="txtDate" runat="server"></asp:TextBox>

jquery is not working in asp.net panel and/or update panel ? need help

I have 3 panels on single .aspx page and depending on condition required panel is displayed . Default panel is panel 1 .  I have created a image gallery which displays thumbnails of various images and when I hover on that image its preview is displayed. I have put the code for this image gallery in 2nd panel, it displays thumbnails but on hover preview is not displayed. but  if I somehow make postback then it works. And I place the same code in !st panel it works ? Can anyone tell me whats wrong with my code? Regards, anas anjaria I have 3 panels on single .aspx page and depending on condition required panel is displayed . Default panel is panel 1 . I have created a image gallery which displays thumbnails of various images and when I hover on that image its preview is displayed.I have put the code for this image gallery in 2nd panel, it displays thumbnails but on hover preview is not displayed. but  if I somehow make postback then it works.<div> /* PAnel 1*/ <asp:UpdatePanel ID="updpnl2" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Panel ID="pnl2" runat="server" Visible="false"> /*other coding stuff*/ <div id="wrap"> <div id="styles-table"> <div id="styles-wrap"&g

reCaptcha+jquery ui modal dialog

Hi, I would like to have a contact form which contains a reCaptcha, and have that form inside a jquery ui modal dialog. All works well, except that I have a submit button for the form - which closes the modal dialog wether the recaptcha is valid or invalid. I tried adding onClientClick="return false;" to the submit button, but it still posts back, and closes the dialog. how do I remain inside the dialog ?

jquery is not working after postback

Hi I am having a small problem with jquery so I did a simple sample to illustrate my problem. the problem is basically that jquery stops working after an autopostback. if you run the sample below, start by setting focus on the first textbox and then blur the first textbox u will notice that the second textbox gets hidden. that all works perfect now try to click on the checkbox to do a postback and then try setting focus on the first textbox. the jquery is no longer working!, why? what am I missing?<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script src="Scripts/jquery-1.2.6.js" type="text/javascript"></script> <script type="text/javascript" > $(document).ready(function() { $("#TxtB1").focus(function() { $("#TxtB2").show("slow"); }); $("#TxtB1").blur(function() { $("#TxtB2").hide("slow"); }); })

MVC2 client validation with jquery dialog


i am trying to get mvc2 client validation working with a jquery dialog, i have pretty much been using the mvc music store example at http://www.asp.net/mvc. if i go to http://localhost/Build/Edit/11, client validation works, but it will not work in the jquery dialog. any ideas?

ViewActive.aspx - main page with a link to popup a form


function showModalEdit(id) {

            var $loading = $('<img src="<%= Url.Content("~/Content/Images/ui-anim_basic_16x16.gif") %>" alt="loading"/>');

            var $dialogEdit = $('<div id="dialogEdit"></div>').append($loading.clone());



                height: 768,

                width: 1024,

                autoOpen: false,

                title: "Modify Build",


get() method of Jquery not properly working in IE



 I used get method for getting JSON data from .aspx page.This JSON data for chart application which show monthly records.For selecting month I used dropdown and defaultly I set current month chart.But for showing previouse month records in chart   i want to select the  previouse month but chart not shows selected Month record rather than it shows default record.

Color Box Jquery Not Working in Update Panel After the Initial Postback


Hi Guys,

I have an UpdatePane that contains a Listview


		<asp:LinkButton ID="lnkName" runat="server" CommandArgument='<%# Container.DisplayIndex %>'
            CommandName="SelectedRow" Text='<%# Eval("Name") %>' Class="info" Rel='<%# Eval("ID") %>' />

This linkButton will serves as the trigger to call my color box jquery. Function stated below

 <script src="script/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="script/jquery.colorbox-min.js" type="text/javascript"> </script>
    <script type="text/javascript">

        $(document).ready(function() {

            $("a.info").click(function() {

                $(this).attr("href", "EmployeeDirectoryDetail.aspx?id=" + $(this).attr("rel"));
                $(this).colorbox({ height: "200p

jquery not working in content pages and debugging jquery


Hey! Friends

        Please provide me some sample code to work with jquery in content pages. For example my jquery code for validating username availability works in web form but not in content page.

Thank You.

Greater and Less Than Date with jQuery and DatePicker in MVC



I have this date value fetch from a Controller but when I use jQuery Datepicker with validation, the output is not good.
The validation is to check if the value is less than or greater than today's date. JQuery Datepicker works well.

If I select a date two days from now using datepicker, the validation error won't occur. Sad

ViewData("DateToday") = Date.Now.ToShortDateString()

<link href="/css/jQuery/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script>
<script src="/js/jquery.validate.min.js" type="text/javascript"></script>
     <script type="text/javascript">
         $().ready(function () {
             $.validator.addMethod("GreaterThanDate", function (value, element) {
                 return new Date.parse(value) > new Date();

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend