ASP.Net里面怎样实现dropdownlist和label联动?
2个回答
展开全部
这个很简单的。
<script langauge=vb runat=server>
sub page_load(sender as object , e as eventargs)
if ispostback = false then
dropdownlist1.items.add("这是选择一")
dropdownlist1.items.add("这是选择二")
dropdownlist1.items.add("这是选择三")
dropdownlist1.items.add("这是选择四")
end if
end sub
sub onchanges(sender as object , e as eventargs)
label1.text = dropdownlist1.selecteditem.text
end sub
</script>
<html>
<form runat=server>
请选择<asp:dropdownlist runat=server id=dropdownlist1 onselectedindexchanged=onchanges
autopostback=true />
<br>你选择了<asp:label runat=server id=label1 />
</form>
</html>
<script langauge=vb runat=server>
sub page_load(sender as object , e as eventargs)
if ispostback = false then
dropdownlist1.items.add("这是选择一")
dropdownlist1.items.add("这是选择二")
dropdownlist1.items.add("这是选择三")
dropdownlist1.items.add("这是选择四")
end if
end sub
sub onchanges(sender as object , e as eventargs)
label1.text = dropdownlist1.selecteditem.text
end sub
</script>
<html>
<form runat=server>
请选择<asp:dropdownlist runat=server id=dropdownlist1 onselectedindexchanged=onchanges
autopostback=true />
<br>你选择了<asp:label runat=server id=label1 />
</form>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询