当我使用asp:ListBox时,它不起作用 [英] When I use asp:ListBox, it does not work
本文介绍了当我使用asp:ListBox时,它不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<asp:ListBox runat="server" ID="myListBox" OnSelectedIndexChanged="myListBox_SelectedIndexChanged" Height="102px"
Width="102px" >
<asp:ListItem Text="ListBox1" Value="MyListBoxa"></asp:ListItem>
<asp:ListItem Text="ListBox2" Value="MyListBoxad"></asp:ListItem>
<asp:ListItem Text="ListBox3" Value="MyListBoxf"></asp:ListItem>
<asp:ListItem Text="ListBox4" Value="MyListBoxc"></asp:ListItem>
</asp:ListBox<asp:Label ID="Label1" runat="server" Text="Label"/>
protected void myListBox_SelectedIndexChanged(object sender, EventArgs e)
{
//Response.Write(this.myListBox.SelectedItem.ToString());
this.Label1.Text = "hello world";
}
当我在VM中运行该程序时,网页上没有任何内容.
你可以帮帮我吗? THS.
When I run this program in my VM, there is nothing in web page.
Could you help me? THS.
推荐答案
set AutoPostBack="true"
</asp:ListBox<asp:Label ID="Label1" runat="server" Text="Label"/>
该行在ListBox之后缺少右括号.因此,这是格式错误的,可能根本无法使用.
This line is missing a closing bracket after ListBox. This is therefore malformed, and probably won''t work at all.
< asp:ListBox runat ="server" ID ="myListBox" OnSelectedIndexChanged ="myListBox_SelectedIndexChanged" Height ="102px "
宽度="102px">
< asp:ListItem Text ="ListBox1" Value ="MyListBoxa"></asp:ListItem>
< asp:ListItem Text ="ListBox2" Value ="MyListBoxad"></asp:ListItem>
< asp:ListItem Text ="ListBox3" Value ="MyListBoxf"></asp:ListItem>
< asp:ListItem Text ="ListBox4" Value ="MyListBoxc"></asp:ListItem>
</asp:ListBox>
< asp:标签ID ="Label1" runat =服务器" Text =标签"/>
您对列表框控件的结束标记不正确.请参考上面的代码以获取帮助.
希望对您有帮助
<asp:ListBox runat="server" ID="myListBox" OnSelectedIndexChanged="myListBox_SelectedIndexChanged" Height="102px"
Width="102px" >
<asp:ListItem Text="ListBox1" Value="MyListBoxa"></asp:ListItem>
<asp:ListItem Text="ListBox2" Value="MyListBoxad"></asp:ListItem>
<asp:ListItem Text="ListBox3" Value="MyListBoxf"></asp:ListItem>
<asp:ListItem Text="ListBox4" Value="MyListBoxc"></asp:ListItem>
</asp:ListBox>
<asp:Label ID="Label1" runat="server" Text="Label"/>
Your closing tag to listbox control was not proper.Refer the above code for help.
Hope this will help you
这篇关于当我使用asp:ListBox时,它不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文