建立在ASP.Net Repeater控件 [英] Create a Repeater control in ASP.Net
本文介绍了建立在ASP.Net Repeater控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用两个下拉菜单和绑定值到下拉。
现在添加一个新的按钮add_new。
我想创建下面当我点击添加按钮并保持previous选定值以上的下拉菜单。请帮我做到这一点。
I'm using two drop down and bind values to that drop down. Now am adding a new button add_new. I want to create the above drop downs below when I click the add button and maintain the previous selected values. Please help me to do this.
推荐答案
您可以实现使用ASP.Net的Repeater控件所期望的结果。如你愿意,你可以创建任何类型的模板,请参见下面的code:
You can achieve the desired result using Repeater control of ASP.Net. You can create any type of template as you wish, see the code below:
ASPX:
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" />
<asp:DropDownList ID="DropDownList2" runat="server" />
<br />
</ItemTemplate>
</asp:Repeater>
codeBehind:
CodeBehind:
protected void Button1_Click(object sender, EventArgs e)
{
// data fetching logic
Repeater1.DataSource = data;
Repeater1.DataBind();
}
这篇关于建立在ASP.Net Repeater控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文