前台:
<
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); // 执行业务逻辑
}
}