473,396 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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="TestingAJAX.aspx.vb" Inherits="TestingAJAX" %>

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" 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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

</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:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label2" runat="server" Text="Label"
Width="168px"></asp:Label>
</ContentTemplate>

<triggers>
<asp:AsyncPostBackTrigger ControlID = "button1"
eventname="click" />
</triggers>
</asp:UpdatePanel>
</form>
</body>
</html>

CODE BEHIND:

Partial Class TestingAJAX
Inherits System.Web.UI.Page

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

End Sub

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

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

Similar topics

7
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....
9
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...
7
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...
14
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,...
1
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...
1
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...
0
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...
8
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...
7
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
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,...

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.