473,545 Members | 2,772 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

UserControls, OutputCache and AutoPostBack problem

I am building an ASP.NET application and have just encountered something very
strange which I would like explained if possible.

In BaseForm.ascx I have the following <form> element:

<form ID="formBaseFor m" method="post" runat="server">
<!-- Banner UserControl -->
<PW:Banner runat="server" ID="Banner1" />

<!-- Initial UserControl -->
<PW:Initial runat="server" ID="Initial1" />

<!-- Content Section -->
<table border="1" width="95%" cellpadding="2" cellspacing="0" >
<tr>
<td>
<!-- content goes here -->
<asp:PlaceHolde r id="_placeHolde r" runat="server" />
</td>
</tr>
</table>
</form>

The unexpected behaviour occurs in the Initial UserControl where I have a
similar table to the one above with four DropDownLists, two of which have
AutoPostBack set to True.

When I do a GET request to an .aspx page that Inherits from BaseForm (and
thus renders the UserControl) and do View | Source, I can see a <SCRIPT>
block in the <body> with the expected __dopostback function, I can also see
the onchange events on the two <select> tags wired up to __dopostback.

When I select another value in one of the DropDownLists where AutoPostback
is True, thus invoking onchange which calls the __dopostback, something
happens which looks like a postback but I don't think is because a breakpoint
in my page_load is not hit. When I do View | Source, I see the <selects>
onchange is still pointing to __dopostback but the entire <SCRIPT> block does
not appear anywhere. When I select another value in one of the DropDownLists
now, I get a JavaScript error "Object expected" because obviously there is
now no __dopostback function.

This only happens when I have the following at the top of Initial.ascx:

<%@ OutputCache Duration="3600" VaryByParam="no ne" %>

The trouble is I haven't the faintest idea why...

Cheers,

Pete

Nov 19 '05 #1
0 1067

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1196
by: Pete | last post by:
I am building an ASP.NET application and have just encountered something very strange which I would like explained if possible. In BaseForm.ascx I have the following <form> element: <form ID="formBaseForm" method="post" runat="server"> <!-- Banner UserControl --> <PW:Banner runat="server" ID="Banner1" /> <!-- Initial UserControl -->
3
1990
by: Ash | last post by:
What is the advantage of using a user control over a .aspx page..
6
2734
by: Tom Kiefer | last post by:
Question: If I have an ASP.NET User Control which defines/exposes a property that the page can use to specify a mode or data subset for the control to use, is there a way to tell the @OutputCache directive to vary its cache based on that property value? I.e., I have: <my:control runat="server" id="mcOne" Flag="One" /> <my:control...
0
295
by: Vassilis T. via .NET 247 | last post by:
The following piece of code, when on a heavily loaded server (more than 50 ASP.NET pages, most using outputcache with varybyparam, lots of users), will only cache the string - the output is not cached, as if the outputcache is ignored. There is available RAM on the server. Other pages are cached as expected. On the development environment and...
1
6411
by: Johan Nedin | last post by:
Hello! I am having a problem with the @OutputCache page directive and Web browser Back Buttons. Problem: After setting <%@ OutputCache Location="None" %> on my pages I get the "Warning! Page has expired" error message, when pushing the Back Button in my Web browser.
5
2153
by: Arpan | last post by:
I am using the following code to cache the page output for 60 seconds: <%@ OutputCache Duration="60" VaryByParam="*" %> <script runat="server"> Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) lblOutput.Text = "Welcome, " & Request.Params("id") & " The time now is " & DateTime.Now.ToString("T") End Sub </script>
2
2669
by: Nalaka | last post by:
Hi, I get the following error, I thought at random intervals. Then I realized, that this happens around the time tha page outputCache is set to expire. So I disabled the page output cache and the problem went away. I put in the outputcache back and the problem is back. I am using forms authentication... and asp.net 2.0. Have you seen...
3
3581
by: =?Utf-8?B?TWlndWVsIElzaWRvcm8=?= | last post by:
Hi, I have an ASP.NET 2.0 application that allows content search. Search is included in all pages and a cross postback to the search results page is performed with the text inserted by the user. The search results also allows refining the search and a search button that performs a postback triggers the search. Many of the web pages in the...
7
2123
by: Nathan Sokalski | last post by:
I have a page which I dynamically add several usercontrols (*.ascx files) to using the following code: Public Sub Refresh() For Each section As DataRow In Me.GetSections().Rows CType(Me.FindControl("admin" & CStr(section("buttontext")).Replace(" ", "")), adminsection2).RefreshSection() Next End Sub
0
7692
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
7946
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
7457
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
6026
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5360
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
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1921
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1045
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
744
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.