Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • saji 83 posts 38 karma points
    Nov 03, 2009 @ 16:35
    saji
    0

    Error Implementing ajax

    Hi  all,

    When i try to implement ajax in usercontrol its giving error "System.Web.HttpParseException: The base class includes the field 'UpdatePanel1', but its type (System.Web.UI.UpdatePanel) is not compatible with the type of control (System.Web.UI.UpdatePanel)."

    I'm using .net 3.5 sp1, MS ASP.NET 2.0 Ajax extensions 1.0  and IIS version is 5.1

    My user control code is:

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="ajaxTest.ascx.cs" Inherits="ajaxTest" %>
    <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        Namespace="System.Web.UI" TagPrefix="asp" %>
       
    <asp:Button ID="Button1" runat="server" Text="Click" onclick="Button1_Click" />
        <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
            <Triggers>
                <asp:AsyncPostBackTrigger  ControlID="Button1" EventName="Click" />
            </Triggers>
            <ContentTemplate>
                <asp:Label ID="Label1" runat="server" Text="UpdatePanel1 not refreshed yet."></asp:Label>
            </ContentTemplate>
        </asp:UpdatePanel>

    .cs files is :

    protected void Button1_Click(object sender, EventArgs e)
        {
            Label1.Text = "UpdatePanel1 refreshed at: " +
              DateTime.Now.ToLongTimeString();
        }

    Also i added <asp:ScriptManager runat="server"></asp:ScriptManager> in master page.

    To implement ajax, do i need to make changes in web.config or any other files. please guide me through to implement ajax.

     

  • Masood Afzal 176 posts 522 karma points
    Nov 03, 2009 @ 17:09
    Masood Afzal
    0

    You have to make changes to webconfig and also add reference to appropriate library in your project file if required.

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Nov 03, 2009 @ 17:35
    Thomas Höhler
    1

    The Ajax versions are different. If you want to use the AJAX included in 3.5 SP1 add the folowing code to the end of the web.config:


    <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
    <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
    </dependentAssembly>
    <dependentAssembly>
    <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
    </dependentAssembly>
    </assemblyBinding>
    </runtime>

    hth, Thomas

  • saji 83 posts 38 karma points
    Nov 03, 2009 @ 18:14
    saji
    0

    Thanks Thomas...

    That made it work :)

  • Max 144 posts 166 karma points
    May 11, 2012 @ 08:31
    Max
    0

    i tried it in umrbaco 4.7 but it does not work

Please Sign in or register to post replies

Write your reply to:

Draft