首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

取出 dropdownlist 下拉框 内容解决方案

2012-02-01 
取出 dropdownlist 下拉框内容举例:取出a,b等内容(内容是动态的)asp:DropDownListID attachments runa

取出 dropdownlist 下拉框 内容
举例   :取出a,b等内容(内容是动态的)                  
<asp:DropDownList   ID= "attachments "   runat= "server ">
                      <asp:ListItem   Value= "-1 "   Selected= "True "> 附   件   清   单... </asp:ListItem>
                            <asp:ListItem> a </asp:ListItem>
                            <asp:ListItem> b </asp:ListItem>
                                </asp:DropDownList>

[解决办法]

Response.Write(attachments.SelectedItem.Text);

[解决办法]
在後台取如樓上的,
如果要在前台取則js如下:

var attachments = document.getElementById( "attachments ");

var text = attachments.options[attachments.selectedIndex].text
[解决办法]

string mm = " ";
foreach(ListItem item in this.attachments.Items)
{
mm += item.Value;
}

return mm;

---------------------------------------------
EMail:bdbox@163.com 请给我一个与您交流的机会!

热点排行