大家来帮帮我,这个问题我给300分 可以的,你用request.Form("listname")来取 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 解决方法其实你可以很好的找到 原因也可以找到的 你自己跟一下的你的程序 看看值是在哪丢的 在哪得到的 你最好把代码贴出来给大家看看 你这样说也不好说你的问题出在哪里。孟子老兄的观点我不是很赞同的。前端脚本修改客户端控件的value这样做没什么不好,起码不用刷新界面。只要方法正确 <%@ Page Language="C#" AutoEventWireup="True" %><html><head> <script runat="server"> void Button_Click(Object sender, EventArgs e) { Label1.Text = "You selected: " + Request.Form["dropdownlist1"].ToString() + "."; } </script></head><body> <form runat="server"> <asp:ListBox id="dropdownlist1" runat="server"> <asp:ListItem>Item 1</asp:ListItem> <asp:ListItem>Item 2</asp:ListItem> <asp:ListItem>Item 3</asp:ListItem> <asp:ListItem>Item 4</asp:ListItem> </asp:ListBox> <br><br> <asp:Button id="Button1" Text="Submit" OnClick="Button_Click" runat="server"/> <br><br> <asp:Label id="Label1" runat="server"/> <input id=x> <input type=button onclick="add()" value="添加"> </form></body></html><script>function add(){//alert(document.getElementById("dropdownlist1").options[2].value)document.getElementById("dropdownlist1").options[document.getElementById("dropdownlist1").options.length] = new Option(document.all.x.value,document.all.x.value,true,true)}</script> 澄清:1/A窗体中用的是listbox,而且要取其中的每个值,用request怎么取2/我调试过,在窗体load的时候listbox里已经没有值了 谢谢各位,但是我试了,request.form的方法虽然可以取到值,但是取的仅仅是listbox中选中项的值,而且提交后listbox就空了 request.form的方法虽然可以取到值,但是取的仅仅是listbox中选中项的值,而且提交后listbox就空了 listbox的autopostback属性设置为true 这个是很正常的,在.net的web中很容易发生这样的事情,就是用javascript程序添加的值不能被正确提交,主要是需要一致性的处理,但是只要你用鼠标或者键盘操作了这个控件结果就会出来了 委托跨线程调用的问题 请教各位高人,image.fromfile() 请教下各位如何使用oAuth.net搭建一个类似新浪微博开放api的oAuth认证服务器 WPF 跪求 求解 在线等待? 写成后台代码 【高手都吃饭去了么?】各位C#高手!求教关于选项卡单击事件 C#,关于写入数据库的问题 winform控件透明 关于DataList的问题 richtextbox插入控件后,当滚动条移动时,控件的位置不变 如何实现outlook中的calendar? 如何区分字段和属性,它们有什么区别?请一一列出 想用C#做一个流媒体服务器,高手帮忙!!!!
孟子老兄的观点我不是很赞同的。前端脚本修改客户端控件的value这样做没什么不好,起码不用刷新界面。只要方法正确
<html>
<head>
<script runat="server">
void Button_Click(Object sender, EventArgs e)
{
Label1.Text = "You selected: " +
Request.Form["dropdownlist1"].ToString() + ".";
}
</script>
</head>
<body>
<form runat="server">
<asp:ListBox id="dropdownlist1" runat="server">
<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>
</asp:ListBox>
<br><br>
<asp:Button id="Button1"
Text="Submit"
OnClick="Button_Click"
runat="server"/>
<br><br>
<asp:Label id="Label1" runat="server"/>
<input id=x> <input type=button onclick="add()" value="添加">
</form>
</body>
</html>
<script>
function add()
{
//alert(document.getElementById("dropdownlist1").options[2].value)
document.getElementById("dropdownlist1").options[document.getElementById("dropdownlist1").options.length] = new Option(document.all.x.value,document.all.x.value,true,true)
}
</script>
1/A窗体中用的是listbox,而且要取其中的每个值,用request怎么取
2/我调试过,在窗体load的时候listbox里已经没有值了