.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 is not working after postback

Posted By:      Posted Date: September 12, 2010    Points: 0   Category :ASP.Net
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"); }); })

View Complete Post

More Related Resource Links

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 $(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 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 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

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

Accordian not working - postback?

Hello all, I've got an acocordian control on my page:<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="WebApplication1.test" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> <!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> </head> <body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="scriptman1" runat="server"> </asp:ScriptManager> <asp:Accordion ID="Accordion1" runat="server" SelectedIndex="0" FadeTransitions="true" FramesPerSecond="40" TransitionDuration="250" AutoSize="None" ContentCssClass="Content" HeaderCssClass="HEADER"> <Panes> <asp:AccordionPane ID="AccordianLandlord" runat="server"><Header><a href="" onclick="return false;" class="Link">Open</a></Header><Content>Conten

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 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

After async postback, hide/show panel stops working

I have a Gridview in an UpdatePanel with a column containing an "expander" button that shows (and hides) more detail beneath its row of data.  It all works great until the user pages the gridview.  After the async postback to page the gridview, the javascript function to toggle hide/show appears to work flawlessly (the expander's button image even changes correctly), but the detail panel just doesn't show on the page.Note that my expander control supports a "AsyncTriggerId" property that, if set in the markup, will rebind the javascript toggle function when that control triggers an async postback (see OnPreRender below)Here's the hide/show toggle javascript:function toggleExpander(divId, imgId) { var div = document.getElementById(divId); var img = document.getElementById(imgId); var cssClass = div.getAttribute("className"); if (div.style.display == "" || div.style.display == "none" || cssClass == "hidden") { div.style.display = "inline"; div.setAttribute("className", ""); img.src = "images/dir_down.png"; mce_src = "images/dir_down.png"; img.alt = "Collapse to hide details"; } else { div.style.display = "none"; img.src = "images/dir_rig

Calendar Extender is not working in IE7 after Postback

We have implemented ajaxtoolkit version: 3.5.40412.0, and my web application is not AJAX enabled. We have included ajaxtoolkit binary reference in our web application. In one of the page, calendar extendar is working fine when it rendar first, after postback it's not working at all in IE7, but it's working fine in Mozilla. The sample code is as below, [ We are not getting any javascript or HTML tag error ]   <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %><asp:Content ID="MyTest" ContentPlaceHolderID="MainContentPlaceHolder" runat="server"><ajaxToolkit:ToolkitScriptManager id="ScriptManager1" runat="server"/><table><td><asp:TextBox ID="txtDate" TabIndex="8" runat="server" Width="144px"></asp:TextBox><ajaxToolkit:CalendarExtender ID="calDate" Format="MM/dd/yyyy" runat="server" TargetControlID="txtDate" PopupPosition="BottomRight" /><asp:RangeValidator ID="DateRangeValidator" runat="server" Display="None" EnableClientScript="false" ControlToValidate="txtDate" ErrorMessage="Selected date is not within range." Type="Date" /><

Hover extender not working after postback

Hi I bind a hover extender to a cell in a gridview, using following code: Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then  Dim hoverMenu As HoverMenuExtender = CType(e.Row.FindControl("hoverMenu"), HoverMenuExtender)  e.Row.Cells(1).Controls.Item(0).ID = e.Row.RowIndex.ToString()     hoverMenu.TargetControlID = e.Row.Cells(1).Controls.Item(0).ID End If End Sub Now This works perfectly and the panel appear when hovering over the second cell.However after a postback it is no longer working and no panel will show when hovering over the cell. Can anybody help plaese?   Jonas   

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)

!POSTBACK not working as expected

I have a site I am trying to set up where the form can be submitted via click of button but when refreshing the page, I do not want it to resend the message. i have found several sites that show using Session Variables and !Postback, but for some reason, when using this action I am still hitting the !Postback condition even when I  do a refresh which I don't think is supposed to happen. Also, when it refreshes it resets the Session["checkrefresh"] variable and throws an error  Object Reference not found i believe on the if statment with the .ToString() check against the ViewState.  Any ideas would be awesome because I'm running out of them         ASPX.CS pageusing System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace CarouselApplicationSuite { public partial class TEStRefresh : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { // If this is not the first time and is a refresh (not button click) set Session Var if (!IsPostBack) { Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString()); } } protected void Button1_Click(object sender, EventArgs e) { if

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"....



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.

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