我选择它时有一个单选按钮,下拉列表正在显示。我希望这个过程没有回发和使用更新面板。 使用radioRatingBool_CheckedChanged事件后,下拉列表可见,但带回发。 但我需要它而不回发。
这里是radiobutton:
<asp:RadioButton ID="radioRatingBool" Text="Bool" runat="server" OnCheckedChanged="radioRatingBool_CheckedChanged" AutoPostBack="true" />
这是功能:
protected void radioRatingBool_CheckedChanged(object sender, EventArgs e)
{
if (IsPostBack)
{
if (radioRatingBool.Checked == true)
ddlRating.Visible = false;
else
ddlRating.Visible = true;
}
}
请尽快帮助我。感谢
答案 0 :(得分:1)
您可以将单选按钮和下拉列表包含在以下html中
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<!-- Your Controls... -->
</ContentTemplate>
</asp:UpdatePanel>
有关如何使用UpdatePanel控件和ScriptManager控件的详细信息,请查看以下链接。
更新小组:http://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel.aspx
脚本管理器:http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.aspx
更新面板教程:http://msdn.microsoft.com/en-us/library/bb399001.aspx
答案 1 :(得分:1)
使用以下内容:
然后..
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel>
<contentTemplate>
Put your contents here..the radio button and drop down
<contentTemplate>
</asp:UpdatePanel>
确保AutoPostback设置为true