无法在后面的代码中访问HTML列表框控件 [英] Can't access html listbox control in code behind
本文介绍了无法在后面的代码中访问HTML列表框控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法使用
推荐答案
嗨
使用html列表框的名称"属性在后面的代码中对其进行访问.请在下面找到代码.
例如,创建名称为用户"的列表框.
<选择id ="list" name ="users" size ="4" style ="width:88px"/>
在aspx代码中使用post方法.
< form id ="form1" name ="form1" runat ="server" method ="post" action =">
现在,在后面的代码中,使用Request.Form访问指定控件名称的html控件.
Hi
Use ''name'' attribute of html listbox to access it in the code behind. Please find the code below.
For example, create listbox with name ''users''.
<select id="list" name="users" size="4" style="width: 88px" />
Use post method in the aspx code.
<form id="form1" name="form1" runat="server" method="post" action="">
Now in the code behind, use Request.Form to access the html controls specifying the name of the control.
protected void Page_Load(object sender, EventArgs e)
{
字符串列表= Request.Form [用户"];
}
希望这会帮助你.快乐的编码..:)
string list = Request.Form["users"];
}
Hope this will help you. Happy coding.. :)
这篇关于无法在后面的代码中访问HTML列表框控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文