473,508 Members | 2,312 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 1860
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
2043
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...
2
1614
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...
3
1885
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...
0
3509
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...
1
5798
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...
8
1915
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
1765
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...
4
5346
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...
6
2627
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...
3
3820
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...
0
7225
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,...
0
7123
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...
0
7383
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...
0
7498
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...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.