遍历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>
后台:
<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);//执行业务逻辑
}
}
{
foreach (Control c in rptFiles.Controls)
{
string process = ((DropDownList)c.FindControl("ddlProcess")).SelectedValue;
string fid = ((Label)c.FindControl("lblFid")).Text;
RegFilesBLL.UpdateProcessByFid(fid, process);//执行业务逻辑
}
}
我这个博客废弃不用了,今天想寻找外链的时候,突然想到这个博客权重很高。
有需要免费外链的,留言即可,我准备把这个博客变成免费的友情链接站点。