<%@ Page Language="C#" CodeFile="UserGroup.aspx.cs" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" Inherits="UserGroup" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderToolbar" runat="Server">
<script language="javascript">
function CheckResult(){
	for (var i=0;i<document.forms[0].elements.length;i++){
		var e = document.forms[0].elements[i];
		if(e.name.substring(e.name.length-9,e.name.length) == 'chkSelect')
			e.checked = document.forms[0].chkAll1.checked;
	}
}

function CheckRelevant(){
	for (var i=0;i<document.forms[0].elements.length;i++){
		var e = document.forms[0].elements[i];
		if(e.name.substring(e.name.length-11,e.name.length) == 'chkDeselect')
			e.checked = document.forms[0].chkAll2.checked;
	}
	
}
</script>
    <table id="__tblSubmitImage" height="100%" style="display: none" width="100%">
        <tr>
            <td align="center">
                <img src="../Images/Sumiting.gif" /></td>
        </tr>
    </table>
    <table cellpadding="5" cellspacing="0" class="Navigator" width="100%">
        <tr>
            <td nowrap="nowrap" width="80">
            </td>
            <td align="left">
                <font class="NavigatorTitle">公告管理->公告信息管理</font></td>
            <td width="150">
            </td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderList" runat="Server">
    <div>

    </div>
    <div style="width: 100%" id="DIV1">
        &nbsp;&nbsp;
        <table>
            <tr>
                <td style="width: 100px; height: 21px;">
                    组/角色
                    <asp:LinkButton ID="btnBackParent" runat="server" OnClick="btnBackParent_Click" Visible="False">返回上级</asp:LinkButton></td>
                <td style="width: 100px; height: 21px;">
                </td>
                <td style="width: 100px; height: 21px;">
                    用戶角色</td>
            </tr>
            <tr>
                <td>
         <asp:GridView ID="dgGroups" runat="server" AllowSorting="True" AllowPaging="True"
            AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" BorderWidth="1px"
            CellPadding="5">
            <SelectedRowStyle Font-Bold="True" ForeColor="#663399" BackColor="#FFCC66"></SelectedRowStyle>
            <RowStyle ForeColor="#330099" BackColor="White"></RowStyle>
            <HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" BackColor="#DDDDDD">
            </HeaderStyle>
            <FooterStyle ForeColor="#330099" BackColor="#FFFFCC"></FooterStyle>
            <Columns> 
                <asp:TemplateField>
                <HeaderTemplate>
                	<INPUT type="checkbox" id="chkAll1" name="chkAll1" onclick="CheckResult();">
                </HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="chkDeselect" runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="GroupID" HeaderText="組編號" Visible="False" />
                <asp:TemplateField SortExpression="GroupName" HeaderText="角色">
                    <ItemTemplate>
                        <asp:Label ID="labRightID" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"GroupName")%>' /></ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField HeaderText="類別" DataField="GroupType" />
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:HyperLink ID="btnDetail" runat="server">查看</asp:HyperLink>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <PagerTemplate>
            </PagerTemplate>
        </asp:GridView></td>
                <td style="width: 100px">  
                 <p><asp:Button ID="btnAdd" runat="server" Text=">>" OnClick="btnAdd_Click" /></p>
                 <p><asp:Button ID="btnRemove" runat="server" Text="<<" OnClick="btnRemove_Click" /></p>
                </td>
                <td style="width: 100px">
        <asp:GridView ID="dgUserGroup" runat="server" AllowSorting="True"
            OnRowDeleting="dgUserGroup_RowDeleting" OnRowCommand="dgUserGroup_RowCommand" OnSorting="dgUserGroup_Sorting"
            AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" BorderWidth="1px"
            CellPadding="5">
            <SelectedRowStyle Font-Bold="True" ForeColor="#663399" BackColor="#FFCC66"></SelectedRowStyle>
            <RowStyle ForeColor="#330099" BackColor="White"></RowStyle>
            <HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" BackColor="#DDDDDD">
            </HeaderStyle>
            <FooterStyle ForeColor="#330099" BackColor="#FFFFCC"></FooterStyle>
            <Columns> 
                <asp:TemplateField>
                <HeaderTemplate>
               	<INPUT type="checkbox" name="chkAll2" id="chkAll2" onclick="CheckRelevant();">
                </HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="chkDeselect" runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="GroupID" HeaderText="組編號" Visible="False" />
                <asp:TemplateField SortExpression="GroupName" HeaderText="角色">
                    <ItemTemplate>
                        <asp:Label ID="labGroupID" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"GroupName")%>' /></ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <PagerTemplate>
            </PagerTemplate>
        </asp:GridView>
                    <table align="center" bgcolor="#e9e9e9" width="100%">
                        <tr>
                            <td style="text-align: right">
                                <asp:LinkButton ID="lbtnPrevious" runat="server" OnClick="lbtnPrevious_Click" Text="上一页"></asp:LinkButton><asp:LinkButton
                                    ID="lbtnNext" runat="server" OnClick="lbtnNext_Click" Text="下一页"></asp:LinkButton></td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>


    <script language="javascript">
		function OpenAdd(){
		location.href("User_RightsEdit.aspx?action=add");
		}
		function OpenEdit(UserID,RightID){
		location.href("User_RightsEdit.aspx?action=edit"
			+ "&amp;UserID=" + UserID
			+ "&amp;RightID=" + RightID);
		}
    </script>

</asp:Content>
