473,761 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Page Posts Back even when using AJAX

To all,

I'm trying to use ajax in my web site project but everytime I hit the button
on my webform the whole page posts back. The label control that I have in my
update panel does what it is suppose to do without effecting any other
controls outside the panel. Can you guys provide any insight? Please keep
in mind that I'm trying to update an existing website and did not start a
whole new project by using the template called, "ASP.NET AJAX-Enabled Web
Site".

I did create a site using an AJAX enabled web site template and found no
issues with using the same code below. I also tried comparing the
differences of my webform (using the same code below) in my existing web site
project and could not determine difference in code....other than that my
webform in my website project is posting the whole page back.

Here is the codes that I'm using:

HTML:

<%@ Page Language="VB" AutoEventWireup ="false"
CodeFile="Testi ngAJAX.aspx.vb" Inherits="Testi ngAJAX" %>

<%@ Register Assembly="Syste m.Web.Extension s, Version=1.0.610 25.0,
Culture=neutral , PublicKeyToken= 31bf3856ad364e3 5"
Namespace="Syst em.Web.UI" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptMana ger ID="ScriptManag er1" runat="server">
</asp:ScriptManag er>

</div>
<br />
<asp:Label ID="Label1" runat="server" Text="Label"
Width="168px"></asp:Label><br />
<br />
<br />
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Button" /><br />
<asp:UpdatePane l ID="UpdatePanel 1" runat="server">
<ContentTemplat e>
<asp:Label ID="Label2" runat="server" Text="Label"
Width="168px"></asp:Label>
</ContentTemplate >

<triggers>
<asp:AsyncPostB ackTrigger ControlID = "button1"
eventname="clic k" />
</triggers>
</asp:UpdatePanel >
</form>
</body>
</html>

CODE BEHIND:

Partial Class TestingAJAX
Inherits System.Web.UI.P age

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
If Not IsPostBack Then
Label1.Text = Date.Now
End If

End Sub

Protected Sub Button1_Click(B yVal sender As Object, ByVal e As
System.EventArg s) Handles Button1.Click
Label2.Text = Date.Now
End Sub
End Class
Mar 15 '07 #1
0 1376

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

Similar topics

7
2309
by: Aaron Prohaska | last post by:
I have just run into a problem where I have a page that posts back to itself to execute code, except when the page does the post back it somehow executes code that is in our home page for the site. The only reason I know that is happening is because I keep track of the pages executed by the user to see how they have traversed the site. Has anyone every seen anything like this before? Regards, Aaron Prohaska
9
1908
by: paul | last post by:
Hi All, We have a small dilemma. We have the following page: http://giggsey.com/m00Cow.php (don't ask about the content) that we want to turn into an interactive application for some new intake students at our school. However - we want to have multiple client PCs running a web interface that will allow them to type in their name / a message, and then this message appears on the "scroller" page, which will be on a projector.
7
3573
by: Schmidty | last post by:
Okay...I have another 'newbie' question; I have a function that loads a page and the action is $_SERVER; In the form that is in a function(method?) within a class a variable is passed back to a mysqli connection and database and updates the database. The problem is that when the page is reloaded it does not show the updated information in the database with the $_SERVER. Why is the page loaded with the same information? Is it cached...
14
23169
by: lmttag | last post by:
Hello. We're developing an ASP.NET 2.0 (C#) application and we're trying to AJAX-enable it. We're having problem with a page not showing the page while a long-running process is executing. So, we're looking for a way to display the page with a "please wait..." message while the process is running, and then, when the process is done, update the page with the actual results/page content. We have a page that opens another browser/page...
1
4852
by: mbruyns | last post by:
i have been trying (and sometimes succeeding) to use the modalpopupextender to show various panels of controls on my asp pages. the strange problem that i keep on running into is that sometimes it works, displaying an awesome popup, while other times, it doesn't show a popup at all, but rather just page posts back and the panel becomes visible at the bottom of the page (where it is situated in the designer). what is even stranger to me is that...
1
3500
by: Rob | last post by:
I know this is an old one, considering how many posts I found on it but I just wondered if any best practises had popped up recently, especially as Ajax has increased JavaScript and DHTML's importance. I'm writing a database application. I like pop-up boxes so I've implemented one on my webpage using a floating DIV. The logic goes like this: 1. When the page is rendered (on the server), it adds "var DisplayPopup = false;" in the page...
0
4581
by: =?Utf-8?B?TGlhbQ==?= | last post by:
Hi, I've implemented AJAX on to one of my pages, I am developing on Windows XP with VS05, I have IIS set up on XP so connect to the dev site using IE and when clicking a control on the updatepanel it just refreshes that section... perfect! I have now completed the page, I deployed it to the web server running Windows Server 2003 64-bit Standard, suddenly when clicking a control in the updatepanel causes a full page postback! I've found a...
8
4746
by: Harvey Schmidlapp | last post by:
I have a fairly complex form (generated by means of an ASP 3 page). The form is used to define a query against a database. After running a query, the user hits their browser's back button and goes back to the form, where their selections show up. They can change whatever they want to change and resubmit the new query. Mostly, everything works fine, with radio buttons, selection lists, check boxes all coming back in the state they were in...
7
7851
by: Microsoft Newsserver | last post by:
Hi Folks. I have an issue I need some help with if thats OK. I am running Framework 2.0 using Windows Integrated Security. For most of the application we manage session timeouts without the user knowing anything about it by ensuring all the essential objects ( only a few ) are in place during session start. For performance, there are some parts of the application which use static
0
9989
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9925
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9811
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8814
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7358
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3913
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
3
2788
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.