遍历Repeater的方法

前台:
<asp:Repeater ID="rptFiles" runat="server">
<ItemTemplate>
<tr>
    
<td><asp:Label ID="lblFid" runat="server" Text="Label"></asp:Label></td>
    
<td><%#Eval("FileName"%></td>
    
<td>
        
<asp:DropDownList ID="ddlProcess" runat="server">
        
</asp:DropDownList>
    
</td>
    
<td><%#Eval("UpTime","{0:yyyy-M-d}"%></td>
</tr>
</ItemTemplate>
</asp:Repeater>
后台:
protected void btnOk_Click(object sender, EventArgs e)
{
    
foreach (Control c in rptFiles.Controls)
    {
        
string process = ((DropDownList)c.FindControl("ddlProcess")).SelectedValue;
        
string fid = ((Label)c.FindControl("lblFid")).Text;
        RegFilesBLL.UpdateProcessByFid(fid, process);
//执行业务逻辑
    }
}
原文地址:https://www.cnblogs.com/greatverve/p/1573750.html