我将尝试使用AJAX和ASP.Net一起实现函数的运行,而无需刷新整个页面,但在此过程中我遇到了一个问题。
以下是我的代码:
事件没有触发是因为我的下拉列表框中没有设置
有没有办法避免使用
我知道可以使用
谢谢。
以下是我的代码:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddl1" runat="server" OnSelectedIndexChanged="update1" />
<asp:TextBox runat="server" ID="txt1" />
</ContentTemplate>
</asp:UpdatePanel>
这是我的后端代码:
Sub update1(ByVal sender As Object, ByVal e As EventArgs)
txt1.Text = Now.ToString
End Sub
事件没有触发是因为我的下拉列表框中没有设置
AutoPostBack="True"
,但是在下拉列表框上添加此属性将会导致整个页面被回传。有没有办法避免使用
AutoPostBack="True"
,只更新面板?我知道可以使用
asp:Button
绕过这个问题,但我真的很想能够使用带有OnSelectedIndexChanged
的下拉列表框。谢谢。