#2
foshan2007-03-25 16:16
|
ASP.NET Ajax 1.0 问题:如何解决UpdatePanel控件之外的TextBox控件接收不到UpdatePanel控件之内Button控件的事件?(用了 <Triggers> 也解决不了问题……)
以下是源文件:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
<asp:FileUpload ID="FileUpload2" runat="server" /><br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<asp:Button ID="Button2" runat="server" Text="Button" OnClick="Button2_Click" />
<asp:FileUpload ID="FileUpload1" runat="server" />
<br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></div>
</form>
</body>
</html>
***************************************************************************
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text = "88";
TextBox2.Text = "99";
}
protected void Button2_Click(object sender, EventArgs e)
{
TextBox1.Text = "AA";
TextBox2.Text = "BB";
}