Results 1 to 8 of 8

Thread: Asp.net Ajex not working.

  1. #1

    Thread Starter
    Addicted Member thirith's Avatar
    Join Date
    Oct 2004
    Posts
    196

    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!

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

  3. #3

    Thread Starter
    Addicted Member thirith's Avatar
    Join Date
    Oct 2004
    Posts
    196

    Re: Asp.net Ajex not working.

    Quote Originally Posted by gep13 View Post
    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!

  4. #4
    Fanatic Member
    Join Date
    Jun 2004
    Location
    All useless places
    Posts
    917

    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

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Asp.net Ajex not working.

    Is this a brand new project or an existing project to which you are adding this page?

  6. #6

    Thread Starter
    Addicted Member thirith's Avatar
    Join Date
    Oct 2004
    Posts
    196

    Re: Asp.net Ajex not working.

    Quote Originally Posted by mendhak View Post
    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!

  7. #7

    Thread Starter
    Addicted Member thirith's Avatar
    Join Date
    Oct 2004
    Posts
    196

    Re: Asp.net Ajex not working.

    Quote Originally Posted by rjv_rnjn View Post
    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!

  8. #8

    Thread Starter
    Addicted Member thirith's Avatar
    Join Date
    Oct 2004
    Posts
    196

    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
  •  



Click Here to Expand Forum to Full Width