gpt4 book ai didi

c# - 如何在父转发器中查找转发器的当前行?

转载 作者:太空宇宙 更新时间:2023-11-03 14:32:06 25 4
gpt4 key购买 nike

<asp:Repeater ID="rp1" runat="server">
<ItemTemplate>
<ul>
<li>
<%#Module(Convert.ToInt32(Eval("id")),Eval("university").ToString()) %>
<asp:Repeater ID="rp2" runat="server">
<ItemTemplate>
<ol>
<li id="sublist" runat="server">
<%#Eval("college") %>
</li>
</ol>
</ItemTemplate>
</asp:Repeater>
</li>
</ul>
</ItemTemplate>
</asp:Repeater>

C#代码

public string Module(int id,string university)
{
con = new SqlConnection(ConStr);
con.Open();
cmd = new SqlCommand("SELECT college FROM tbluniversity where id=" + id, con);
da = new SqlDataAdapter(cmd);
con.Close();
ds = new DataSet();
da.Fill(ds);


//Here I want to find the inner repeator of current row then bind this dataset to that.
how to find Repeator


return university;
}

最佳答案

你必须添加一个 ItemCreated 事件,你可以使用 e.Item.FindControl 方法使用它的 id 找到你的内部转发器

关于c# - 如何在父转发器中查找转发器的当前行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2377667/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com