遍历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);
//执行业务逻辑
    }
}
posted @ 2009-09-25 09:15  大气象  阅读(685)  评论(0编辑  收藏  举报
http://www.tianqiweiqi.com