这是我的源代码。我选择了一个下拉列表,并尝试在下拉选择后显示勾选图像,但我想避免页面刷新,我也尝试了更新面板,但它不起作用:
<div class="col-md-5" style="margin-bottom: 10px;">
<asp:DropDownList ID="cmbExpectedMarks1" CssClass="form-control chzn-select" AutoPostBack="true" runat="server" OnSelectedIndexChanged="cmbExpectedMarks1_SelectedIndexChanged1" >
<asp:ListItem>Average</asp:ListItem>
<asp:ListItem Selected="True"> First Class</asp:ListItem>
<asp:ListItem>Merit</asp:ListItem>
<asp:ListItem>Distinction</asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-sm-1">
<asp:ImageButton ID="Img123" runat="server" ImageUrl="~/images/glipcon_ok.png" Visible="false" style="Height:22px;Width:22px;" ImageAlign="Middle" />
</div>
我的.cs代码是
protected void cmbExpectedMarks1_SelectedIndexChanged1(object sender, EventArgs e)
{
Img123.Visible = true;
}
答案 0 :(得分:0)
您可以使用以下JS代码段实现相同的目标。
twitterData = twitterEngine.lookupTweets(tweets)
future = asyncio.gather(*twitterData)
loop = asyncio.get_event_loop()
loop.run_until_complete(future)
print(future.result())
答案 1 :(得分:0)
如果您真的想使用UpdatePanel
(并避免使用任何JavaScript / jQuery代码),则以下内容应该有效:
web窗体:
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div class="col-md-5" style="margin-bottom: 10px;">
<asp:DropDownList
ID="cmbExpectedMarks1"
CssClass="form-control chzn-select"
AutoPostBack="true"
runat="server"
OnSelectedIndexChanged="cmbExpectedMarks1_SelectedIndexChanged">
<asp:ListItem>Average</asp:ListItem>
<asp:ListItem Selected="True"> First Class</asp:ListItem>
<asp:ListItem>Merit</asp:ListItem>
<asp:ListItem>Distinction</asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-sm-1">
<asp:ImageButton ID="Img123" runat="server" ImageUrl="~/images/glipcon_ok.png" Visible="false" Style="height: 22px; width: 22px;" ImageAlign="Middle" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
代码隐藏:
protected void cmbExpectedMarks1_SelectedIndexChanged(object sender, EventArgs e)
{
Img123.Visible = true;
}