Repeater中DropDownList 选择的值如何获取
1个回答
展开全部
方法如下。
下面直接举个例子:
<asp:Repeater ID="ArticleList" runat="server" onitemdatabound="setSelectList"
<HeaderTemplate
<table width="100%" border="0" cellspacing="0" cellpadding="0"<tr<td width="40" align="center" bgcolor="#CBDAF8"ID</td</tr</HeaderTemplate
<ItemTemplate
<tr onMouseOver ="this.style.backgroundColor='#ffffff'" onMouseOut ="this.style.backgroundColor=''"
<td align="center"<asp:DropDownList ID="taxis" runat="server" autopostback="true" OnSelectedIndexChanged="taxis_SelectedIndexChanged"
</asp:DropDownList</td</tr</ItemTemplate
<FooterTemplate</table</FooterTemplate
</asp:Repeater
如上代码中,Repeater中DropDownList值如果获得呢.
方法如下:protected void taxis_SelectedIndexChanged(object sender, EventArgs e){string cid = Request.QueryString["cid"];
string key = Request["keyword"];
if (cid == null){cid = "0";}if (key == null)
{ key = ""; }
DropDownList drop = sender as DropDownList;//这是定义对象
string strCountry = drop.SelectedValue;//这是获得值
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询