.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 goes away after postback.

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

I am using the version 1.8.5 DatePicker on a page in an ASP.Net 3.5 application. It is being used in an Ajax Modal Popup which is on a user control. The date picker is used as part of the criteria for a database search. On the initial load, the calendar button image is shown and the calendar works as normal. If the search crieteria does not return any values, a postback is completed and as expected the modal popup dissapears. However, if the button causing the modal popup to show is clicked again, the datepicker button image does not show and the associated textbox does not show the behaviour of the datepicker.

There is nothing in the code that I can see that would prevent the datepicker behaviour to disappear. The remainder of the controls on the popup work fine.

I am new to jQuery UI and so I am not sure where to even look. Any help on this would be greatly appreciated.

View Complete Post

More Related Resource Links

jQuery $(document).ready() and ASP.NET Ajax asynchronous postback

Many call it the ASP.NET jQuery postback problem, but using the technique below should make it no problem anymore. $(document).ready() isn't called after an asynchronous postback. What this means? You lose the functionality that should be executed within $(document).ready() after an UpdatePanel rendered its contents after an asynchronous postback.

jQuery live() and ASP.NET Ajax asynchronous postback

The issue is that normally $(document).ready() is called when the DOM is ready to be manipulated. But this doens't happen after an ASP.NET Ajax asynch postback occurs.

This means that the initial jQuery bindings won't be automatically available after the asynchronous postback is over. I underline "automatically" here because my last post describes more possibilities, how this issue can be worked around.

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');
}); });


jquery click event doesn't fire after postback anymore

Hello there,I have a small website where I want to display a confirmation dialog after clicking on a button.When you click the confirmButton the dialog appears. Then you can choose between Yes or No to either continue with the PostBack or to return.Problem: The first time you get into the site all works fine. But after you click Yes to continue with the PostBack, no click event will be triggered anymore.Here is some code.<asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <script type="text/javascript"> function loadConfirmDialog() { //Dialog configurieren jQuery('#confirmDialog').dialog({ autoOpen: false, width: 400, modal: true, resizable: false }); //Dialog öffnen jQuery('#confirmButton').bind('click', function () { jQuery('#confirmDialog').dialog('open'); return false; }); //Postback ausführen jQuery('#continueButton').bind('click', function () { jQuery('#confrimDialog').dialog('destroy'); __doPostBack('confirmButton', ''); }); //Postback abbrechen jQuery('#cancel

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>

Is there a function in Jquery which run only one time no matter load page or PostBack

In asp.net, I can use Method A to run somethings A one time, and somethings A will nor run when page is postback but In JQuery, I hope to run something B one time when the page is loaded, but if I use Method B, the "Somethings B" always run even the page is pastBack, how can I do? Thanks! ------------------Method A------------protected void Page_Load(object sender, EventArgs e){    if (!IsPostBack)    {       //Do Somethings A    } }   ------------------Method B------------$(document).ready(function () {   //Do Somethings B})

Jquery.tools tabs doesn't retain tab index on postback

The graphic designer of a project I'm building a web site for chose jquery.tools (http://flowplayer.org/tools/tabs/index.html) for a tabs tool in the site. Unfortunately it seems that the tool doesn't behave properly on a postback in IE7 or IE8 (it does behave properly in FireFox, Chrome and Safari). Does anyone have experience using the jquery.tools with asp.net? and know how to retain the tab index on a postback? I've tried a lot of things and can't get it to work. The code i'm using now is as follows:           $("ul.tabsScenario").tabs("div.panes > div");         var tabIndex = $('#ctl00_ContentPlaceHolder1_EnInDeToekomst1_HiddenFieldTabIndex').val();         $("ul.tabsScenario").tabs('select', tabIndex); where the tab index is stored in a hidden field (HiddenFieldTabIndex). The above code works fine in Firefox, Chrome and Safari, but not in IE7 or IE8. I am using a ScriptManager and UpdatePanels, but in an extremely simple website example I can't even get the jquery.tools tabs tool to work. There are some unanswered posts on the Jquery.Tools forum concerning this topic, but yeah, that doesn't help much. I've already determined that the

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"); }); })

Using jQuery .hide() and .show() on panel sets doesn't maintain status through postback. Viewstate

I'm using jQuery against a set of three asp panels.  I set up an 'onChange' function for a dropdown list that dictates which panels to hide and show based on the UI selection.When the page first loads, one of the panels will be shown, the others will be hidden.  Let's say pnlOne is showing because the dropdown has option 1 selected.  This is done on the server with this:pnlOne.Style.Add("display","block");//and all the other panels are set to ".Style.Add("display","none");" based on logic.Then, the user selects a different value in the dropdown.  Let's say they select option number 2.  With javascript and jQuery I do this:$("#<%=pnlOne.ClientID %>").hide();$("#<%=pnlTwo.ClientID %>").hide();$("#<%=pnlThree.ClientID %>").hide();switch($("#<%= ddlOptionNumber.ClientID %> option:selected").text()){case "1":$("#<%= pnlOne.ClientID %>").show();break;case "2": etc.,}The issue is when the page posts back.  I'm running client side validation only at this point.  (Even if I add client side in the future I will still run client side as well to avoid security issues.)  When the validation functions detect an issue and the page returns to be displayed, the original panel (pnlOne)

jquery and do a postback


I have designers doing most of the frontend work but I have this and need to figure out to make it postback so that I can update other parts of the page. I tried various methods and cannot use a <asp:TextBox... Has to be a <input type="hidden"....



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

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();



HI to every one

 i am having a problem with jquery  ...

 what is that means

 i am using jqury auto fill in my asp.net page  in 3 places and  i am using a westwind datepicker .dll 

 when i am running the page auto suggest is commig and errors in the page (ie for jquerydate picker )

object does not support this type

 can  any one sort out this problem please


popout jquery datepicker from asp.net textbox




i have a simple asp.net textbox.

please can someone provide me with an example so that when the user clicks inside the textbox, a jquery datepicker popsout?

also, i need it so that when the user clicks a date in the datepicker, the textbox is populated with this date.

many many thanks 

jquery datepicker not working in dialog



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

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