日期:2014-05-19  浏览次数:20799 次

取出 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 请给我一个与您交流的机会!