<tr>
<td><%=this.FunctionName %></td>
<td>
<input id="chk_<%=this.ClientID %>" type="checkbox" onclick="ckall(this,'fun_<%=this.ClientID %>')"/>全选
<span id="fun_<%=this.ClientID %>">
<asp:CheckBox ID="ckinsert" runat="server" Text="新增"/>
<asp:CheckBox ID="ckedit" runat="server" Text="编辑"/>
<asp:CheckBox ID="ckdelete" runat="server" Text="删除"/>
<asp:CheckBox ID="ckview" runat="server" Text="查看"/>
<asp:CheckBox ID="ckexecute" runat="server" Text="执行" />
<asp:CheckBox ID="cklist" runat="server" Text="列表"/>
<asp:CheckBox ID="ckprint" runat="server" Text="打印" />
</span>
</td>
</tr>
public partial class SuperRoles_Power_Detail : System.Web.UI.UserControl
{
private string functionID;
/// <summary>
/// 功能ID
/// </summary>
public string FunctionID
{
get { return functionID; }
set { functionID = value; }
}
private string functionName;
/// <summary>
/// 功能名称
/// </summary>
public string FunctionName
{
get { return functionName; }
set { functionName = value; }
}
/// <summary>
/// 新增
/// </summary>
public bool IsInsert
{
get { return this.ckinsert.Checked; }
set { this.ckinsert.Checked = value; }
}
/// <summary>
/// 编辑
/// </summary>
public bool IsEdit
{
get { return this.ckedit.Checked; }
set { this.ckedit.Checked = value; }
}
/// <summary>
/// 删除
/// </summary>
public bool IsDelete
{
get { return this.ckdelete.Checked; }
set { this.ckdelete.Checked = value; }
}
/// <summary>
/// 查看
/// </summary>
public bool IsView
{
get { return this.ckview.Checked; }
set { this.ckview.Checked = value; }
}
/// <summary>
/// 执行
/// </summary>
public bool IsExecute
{
get { return this.ckexecute.Checked; }
set { this.ckexecute.Checked = value; }
}
/// <summary>
/// 列表
/// </summary>
public bool IsList
{
get { return this.cklist.Checked; }
set { this.cklist.Checked = value; }
}
/// <summary>
/// 打印
/// </summary>
public bool IsPrint
{
get { return this.ckprint.Checked; }
set { this.ckprint.Checked = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
}
WebUserControl.SuperRoles_Power_Detail detail = (WebUserControl.SuperRoles_Power_Detail)item1.FindControl("SuperRoles_Power_Detail1");
Guid FunctionID = Guid.Parse(detail.FunctionID);
string functionChecked = string.Empty;
if (detail.IsInsert) functionChecked += SuperRoles.Enum.Command.Insert + ",";
if (detail.IsEdit) functionChecked += SuperRoles.Enum.Command.Edit + ",";
if (detail.IsDelete) functionChecked += SuperRoles.Enum.Command.Delete + ",";
if (detail.IsView) functionChecked += SuperRoles.Enum.Command.View + ",";
if (detail.IsExecute) functionChecked += SuperRoles.Enum.Command.Execute + ",";
if (detail.IsList) functionChecked += SuperRoles.Enum.Command.List + ",";
if (detail.IsPrint) functionChecked += SuperRoles.Enum.Command.Print + ",";
if (functionChecked == string.Empty) continue;
functionChecked = functionChecked.TrimEnd(',');
protected void Rep_BoundFunction(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
DataRowView rowv = (DataRowView)e.Item.DataItem;//找到分类Repeater关联的数据项
WebUserControl.SuperRoles_Power_Detail detail = (WebUserControl.SuperRoles_Power_Detail)e.Item.FindControl("SuperRoles_Power_Detail1");
if (rowv != null)
{
detail.FunctionID = rowv["ID"].ToString();
detail.FunctionName = rowv["Title"].ToString();
}
}
}
<asp:Repeater ID="Rep_SystemFunction" runat="server" OnItemDataBound="Rep_BoundFunction">
<ItemTemplate>
<uc_Function:SuperRoles_Power_Detail ID="SuperRoles_Power_Detail1" runat="server"/>
</ItemTemplate>
</asp:Repeater>