none
ajaxtoolkit中 用PopupExtender 弹出list时报错【RegisterDataItem can only be called during an async postback.】。帮忙解决下,谢啦 RRS feed

  • 问题

  •  

    我是在asp.net网站中加入ajaxtoolkit功能的。选择listbox中的值付给TextBox时报错RegisterDataItem can only be called during an async postback。代码如下:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddPlan.aspx.cs" Inherits="AddPlan" %>

    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>


    <%@ Register Namespace="ExtendWebControls" TagPrefix="ExtendWebControls" %>


    <%@ 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>无标题页</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <br />
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            &nbsp; &nbsp; &nbsp;&nbsp;<aspTongue TiedcriptManager ID="ScriptManager1" runat="server">
            </aspTongue TiedcriptManager>
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            &nbsp; &nbsp;&nbsp; &nbsp;<asp:Label ID="Label2" runat="server" Text="从文件导入计划信息"></asp:Label><br />
            &nbsp;<br />
            &nbsp;<asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <cc1Stick out tongueopupControlExtender ID="PopupControlExtender1" runat="server" PopupControlID="ListBox1"
                        TargetControlID="TextBox1" Position="Bottom" BehaviorID="PopupControlExtender1">
                    </cc1Stick out tongueopupControlExtender>
                    &nbsp;<asp:Label ID="Label3" runat="server" Text="计划名"></asp:Label>&nbsp;<asp:TextBox ID="TextBox1" runat="server" Width="100px" autocomplete="off"></asp:TextBox>&nbsp;&nbsp;
                    &nbsp;&nbsp;<br />
                    &nbsp;
                    <asp:ListBox ID="ListBox1" runat="server" OnSelectedIndexChanged="ListBox1_SelectedIndexChanged" Width="100px" AutoPostBack="True"></asp:ListBox><br />
                    <br />
                    <asp:Label ID="Label1" runat="server" Font-Size="Small" Text="请选择要导入的文件"></asp:Label><asp:FileUpload ID="FileUpload1" runat="server" Font-Size="Small" Width="552px" /><br />
                    <br />
                    <asp:CheckBox ID="CheckBox3" runat="server" Text="存在相同计划时删除" /><br />
            <asp:CheckBox ID="CheckBox1" runat="server" Text="存在相同模块时删除" /><br />
                    <br />
            <asp:Label ID="Label4" runat="server" Text="Label"></asp:Label><br />
            <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="导入" />
                </ContentTemplate>
            </asp:UpdatePanel>
            &nbsp;<br />
            <br />
            &nbsp;
            <br />
            <br />
            <br />
            <br />
            &nbsp;<br />
            <br />
            <br />
            &nbsp;<br />
            &nbsp;
            </div>
        </form>
    </body>
    </html>

    2009年1月8日 1:24

答案

  • UpdatePanel中不能用FileUpLoad控件。因此无法支持异步上传。如果一定要用异步上传,你可以看看赵老师的博客。
    http://jeffz.blog.51cto.com/309226/59904
    2009年1月13日 3:12