473,569 Members | 2,402 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Ajax loaded div with autopostback

1 New Member
I have a page that runs a jquery onclick event. The event loads an an external .aspx file into a div. The page that's being loaded has a drop down list with an autopostback attribute that passes the selected item to a label.

Everything works fine except that the .aspx file that's being loaded will only post back once. After that no more autopostback. Here's my code

----- external.aspx ------
Expand|Select|Wrap|Line Numbers
  1.  <script> 
  2. protected void ddlPrices_SelectedIndexChanged(object sender, EventArgs e)
  3.    {
  4.     lblPrice.Text = ddlPrices.SelectedValue.ToString();
  5.    }
  6.  </script>
  7.  
  8.  
  9. <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
  10.      <asp:UpdatePanel ID="UpdatePanel1" runat="server">
  11.     <ContentTemplate>
  12. <asp:DropDownList ID="ddlPrices" runat="server" AutoPostBack="true" 
  13.     onselectedindexchanged="ddlPrices_SelectedIndexChanged">
  14. <asp:ListItem>Basic</asp:ListItem>
  15. <asp:ListItem>Pro</asp:ListItem>
  16. <asp:ListItem>Platinum</asp:ListItem>
  17. <asp:ListItem>Baller!</asp:ListItem>
  18. </asp:DropDownList> 
  19.  
  20. <asp:Label ID="lblPrice" runat="server"></asp:Label>          
  21. </ContentTemplate>
  22. </asp:UpdatePanel>
  23.  
---- default.aspx ------
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. $(document).ready(function () {
  3. $("li#empNav1").click(function () {
  4. $("div.subItem").load('external.aspx');
  5. });
  6. });
  7. </script>
  8.  
  9.  <ul class="nav-left">
  10. <li id="empNav1" class="selected"><a href="#">Employer Overview</a></li>
  11. <li id="empNav2"><a href="#">Why We're Better</a><span></span></li>
  12. </ul>
  13. <div class="subItem"></div>
  14.  
As stated the div loads just fine, but external.aspx will only update lblPrice once. Then it no longer auto updates. Any help would be greatly appreciated specifics please....
Oct 3 '11 #1
1 1866
acoder
16,027 Recognized Expert Moderator MVP
This will probably be because the response is cached. Use appropriate headers or make a unique URL using, e.g. date/time stamp:
Expand|Select|Wrap|Line Numbers
  1. (new Date()).getTime()
Oct 13 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2051
by: battle.chris | last post by:
Hello. I'm using Prototype's Updater class to refresh sections of a page. Is there a way to include an external javascript files in the updated content; i.e., have a javascript tag with src attribute? Can't seem to get this to work. Also, if there is a way, will the browser cache any dynamically loaded scripts?
2
1619
by: haderach | last post by:
Hi everyone, I have a HTML page and I'm replacing a div by some HTML code using Ajax. The problem is that I cannot access the newly added HTML tags as their IDs are not part of the original page DOM, so getElementById etc won't work. How can I add the loaded HTML (or XML) to the current page DOM? Note that I'm also using prototype, does...
3
1886
by: xhunter | last post by:
I am loading a page using ajax, but the problem is that the javascript functions existing on that page would no longer be available when loaded through ajax, is there anyways to load a page in a way that the javascript functions on that page would still work, I am loading some pages that do not belong to me and I can not create javascripts...
0
3514
by: Med | last post by:
Hi, I have two dropDown lists ddlCars and ddlModels. ddlCars AutoPostBack="true" to populate the ddlModels when a car is selected. If the page is not valid (i.e. user left a mandatory textbox blank and presented by ValidatorCalloutExtender message when attempting to submit), selecting an item in ddlCars DOES NOT postback the first time,...
1
5809
by: nicky77 | last post by:
Hi, I'm trying to integrate a photo gallery into a site where the content section of the page is loaded using AJAX. I'm using Lightbox for the gallery and although the gallery works fine as a separate page, I now need to add the following events to the <div> containing the gallery: onload="focus_first_input(); initLightbox();" Does anyone know...
8
1919
by: tuananh87vn | last post by:
i have a sample code like below: index.html <script language='javascript'> //start xmlhttprequest if (window.XMLHttpRequest) //for IE 7 & FF { request=new XMLHttpRequest(); }
1
1772
by: nicky77 | last post by:
Hi, apologies in advance is this may be a nonsensical ramble, but I'm hoping someone can give me some advice on how to solve the following problem: I'm developing a site where the main content is loaded dynamically (and using a fade effect) into a placeholder div using AJAX. This is all working fine, however the tricky part for me is making...
4
5348
by: Peter | last post by:
ASP.NET I have an application which use ASP.NET Autocomplete extender which works great. But I have a question how to update all the fields on the screen using Ajax. Users starts typing in a text field which causes the Autocomplete extender to display 10 like items, after the users selects an item (which is a key in the database) I want...
6
2629
by: SAL | last post by:
hello, I'm using a radiobuttonlist in an updatepanel in an item template in a Gridview control. I'm populating the radiobuttonlist in the RowDataBound event. I have the control toolkit registered in the page and I've got code to get the selected value from it in the Radiobuttonlist_SelectedIndexChanged event. The code in there is: ...
3
3824
by: =?Utf-8?B?Y21lZWsxXzE5OTk=?= | last post by:
Hello, On a webpage, create an UpdatePanel with two DropDownLists. Set AutoPostBack of DropDownList1 to true. In the SelectedIndexChanged method, refill DropDownList2 and set the focus to DropDownList1 using the ScriptManager SetFocus method. Use the Visual Studio debugger. Set a breakpoint on in the (!IsPostBack) part of the PageLoad...
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7679
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3657
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.