在中继器中获取DropDownList值 [英] Getting DropDownList values in a repeater
本文介绍了在中继器中获取DropDownList值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
ASPX PAGE:
<asp:Repeater ID="GeneralRepeater" runat="server"
OnItemDataBound="GeneralRepeater_OnItemDataBound">
<ItemTemplate>
<tr>
<td>
DxPoc:
<asp:DropDownList ID="GeneralDDL" DataTextField="DiagnosisCode"
DataValueField="DiagnosisCode" runat="server" />
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
CODE BEHIND:
protected void GeneralRepeater_OnItemDataBound(object sender,
RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem)
{
DropDownList myDDL = (DropDownList)e.Item.FindControl("GeneralDDL");
Diagnosis oDiagnosis = new Diagnosis();
DataView dv = new DataView(oDiagnosis.GetDiagnosis());
myDDL.DataSource = dv;
myDDL.DataTextField = "DiagnosisCode";
myDDL.DataValueField = "DiagnosisCode";
myDDL.DataBind();
}
}
上面给出的给出不起作用正常。在页面加载期间,中继器内的
dropdownlist没有任何反应。
The given shown above is not working properly. During page load it nothing happens on the dropdownlist inside the repeater.
问题:
a。)如何获取我的下拉列表
与中继器
之间的对象列表
a.) How I'll get the values of my dropdownlist
with list of objects inside the repeater
?
谢谢!
推荐答案
if(!IsPostBack)
{
BindRepeater();
}
这篇关于在中继器中获取DropDownList值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文