0
之外下面我有一個列表框代碼:更改標籤文本不工作時的UpdatePanel
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ListBox ID="ListBox1" runat="server" onselectedindexchanged="ListBox1_SelectedIndexChanged" AutoPostBack="True">
<asp:ListItem Value="0">Item1</asp:ListItem>
<asp:ListItem Value="1">Item2</asp:ListItem>
<asp:ListItem Value="2">Item3</asp:ListItem>
</asp:ListBox>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<asp:Label ID="lblTB" runat="server"/>
這是該指數改變了事件背後的代碼:
protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
lblTB.Text = "You choose: " + ListBox1.SelectedItem.Text;
}
我不想將控制標籤放入UpdatePanel。我怎樣才能讓這段代碼運行?謝謝大家。
我已經scriptmanager,但仍然不工作。 –
有沒有錯誤?零件不工作在哪裏?在你的代碼背後? –
沒有錯誤,但什麼都不運行。我有後面的代碼。 –