|
-
Aug 9th, 2009, 08:21 PM
#1
Thread Starter
Addicted Member
Asp.net Ajex not working.
Hi all,
I am new in Asp.net Ajex. I am trying to use Ajex in my project but it doesnot working as I expected.
When i click on the button to change text of label, it refresh whole page not only label control.
my asp.net code:
HTML Code:
asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:TextBox ID="txt" runat="server">
</asp:TextBox>
<asp:Label ID="lbl" runat="server">
</asp:Label>
<asp:Button ID="btn" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
ជីន ច័ន្ទធិរិទ្ធ៖ពេលវេលាពុំដែលរង់ចាំអ្នកឡើយ!Time never wait you!
-
Aug 10th, 2009, 02:19 AM
#2
Re: Asp.net Ajex not working.
Hey,
Is that the only code that you have on your page? Or do you have any other markup on the screen?
Which version of Visual Studio are you using? If you are using Visual Studio 2005 have you added the necessary references to the AJAX Extensions?
Have a look at the following videos which should give you some tips:
http://www.asp.net/learn/ajax-videos/
Hope that helps!!
Gary
-
Aug 10th, 2009, 02:26 AM
#3
Thread Starter
Addicted Member
Re: Asp.net Ajex not working.
 Originally Posted by gep13
Hey,
Is that the only code that you have on your page? Or do you have any other markup on the screen?
Which version of Visual Studio are you using? If you are using Visual Studio 2005 have you added the necessary references to the AJAX Extensions?
Have a look at the following videos which should give you some tips:
http://www.asp.net/learn/ajax-videos/
Hope that helps!!
Gary
Yes, I did watch sample Video on Asp.net web site. I also pratice with that too and it was successed.
The project that is not working did not show any error on the page.
The problem is only, when i click on button it refresh a whole page not only control in update panel.
Anyway, I used VS 2008.
ជីន ច័ន្ទធិរិទ្ធ៖ពេលវេលាពុំដែលរង់ចាំអ្នកឡើយ!Time never wait you!
-
Aug 10th, 2009, 10:32 AM
#4
Fanatic Member
Re: Asp.net Ajex not working.
That's surprising. I took your HTML code and the page doesn't do a full postback. Here is the code
Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ForumTest.aspx.vb" Inherits="ForumTest" %>
<!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></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:TextBox ID="txt" runat="server" Width="20em">
</asp:TextBox>
<asp:Label ID="lbl" runat="server">
</asp:Label>
<asp:Button ID="btn" runat="server" Text="Click Me!" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
And code behind
Code:
Partial Class ForumTest
Inherits System.Web.UI.Page
Protected Sub OnClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn.Click
txt.Text = "Updated time:" + DateTime.Now()
End Sub
End Class
-
Aug 10th, 2009, 01:58 PM
#5
Re: Asp.net Ajex not working.
Is this a brand new project or an existing project to which you are adding this page?
-
Aug 10th, 2009, 09:19 PM
#6
Thread Starter
Addicted Member
Re: Asp.net Ajex not working.
 Originally Posted by mendhak
Is this a brand new project or an existing project to which you are adding this page?
It is an exist project.
For branch new project it works.
ជីន ច័ន្ទធិរិទ្ធ៖ពេលវេលាពុំដែលរង់ចាំអ្នកឡើយ!Time never wait you!
-
Aug 10th, 2009, 09:24 PM
#7
Thread Starter
Addicted Member
Re: Asp.net Ajex not working.
 Originally Posted by rjv_rnjn
That's surprising. I took your HTML code and the page doesn't do a full postback. Here is the code
Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ForumTest.aspx.vb" Inherits="ForumTest" %>
<!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></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:TextBox ID="txt" runat="server" Width="20em">
</asp:TextBox>
<asp:Label ID="lbl" runat="server">
</asp:Label>
<asp:Button ID="btn" runat="server" Text="Click Me!" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
And code behind
Code:
Partial Class ForumTest
Inherits System.Web.UI.Page
Protected Sub OnClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn.Click
txt.Text = "Updated time:" + DateTime.Now()
End Sub
End Class
Yes, it is. the same code but new project and it works. I think because of configuration. But I cannot find what's wrong in my configuration file. Because when I did a comparison line by line with work project, it is the same.
ជីន ច័ន្ទធិរិទ្ធ៖ពេលវេលាពុំដែលរង់ចាំអ្នកឡើយ!Time never wait you!
-
Aug 15th, 2009, 01:32 PM
#8
Thread Starter
Addicted Member
Re: Asp.net Ajex not working.
Hey all,
I found what is the solution.
Because XHTMLConformance mode set to "Legacy".
Useful link:
http://sankarsan.wordpress.com/2008/...l-conformance/
Thanks,
Chan
ជីន ច័ន្ទធិរិទ្ធ៖ពេលវេលាពុំដែលរង់ចាំអ្នកឡើយ!Time never wait you!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|