<%@ page language="C#" masterpagefile="~/manage/Main.master" autoeventwireup="true" validaterequest="false" inherits="manage_PageChild, App_Web__x3qmtgh" title="子栏目列表" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MidContent" Runat="Server">
   <div id="main">
     <asp:UpdatePanel ID="MsgUpdatePanel" UpdateMode="Conditional" runat="server">
        <ContentTemplate>
            <asp:Label id="Msg" runat="server" Text="" CssClass="msg" Visible="False" EnableViewState="False"></asp:Label>
        </ContentTemplate>
     </asp:UpdatePanel>
     <asp:UpdatePanel ID="PageListUpdatePanel" UpdateMode="Conditional" runat="server">
        <ContentTemplate>
            <asp:Panel ID="MpePanel" runat="server" CssClass="" Style='display: none' >
                <asp:Panel ID="TitlePanel" CssClass="MTop"  runat="server">
                  <div class="MTopLeft"></div>
                  <div class="MTopMid"><a class="MTopClose" title="关闭" href="javascript:hideModalPopupViaClient('PageList');"></a><span class="MTitle">系统提示</span></div>
                  <div class="MTopRight"></div>
                </asp:Panel>
                  <div class="MMid">
                    <div class="MMidBox">
                        <table border="0" cellpadding="0" cellspacing="0">
                          <tbody>
                            <tr>
                              <th class="MIcon"><div class="MIconInfo"></div></th>
                              <td class="MContext">将同时删除此栏目、所有子栏目、及其栏目内所有内容。<br />
                                确定删除吗?</td>
                            </tr>
                          </tbody>
                        </table>
                    </div>
                  </div>
                  <div class="MBott">
                    <div class="MBottLeft"></div>
                    <div class="MBottMid">
                      <div class="MBtBox">
                        <asp:Button ID="OkBt" runat="server" CssClass="MBt MOk" Text="确 定" />
                        <asp:Button ID="CancelBt" runat="server" CssClass="MBt MCancel" Text="取 消" />
                      </div>
                    </div>
                    <div class="MBottRight"></div>
                  </div>
            </asp:Panel>
            <asp:GridView ID="PageList" runat="server" AllowPaging="True" AutoGenerateColumns="False" OnPageIndexChanging="PageList_PageIndexChanging" DataKeyNames="SinglePageId" PageSize="11" OnRowDeleting="PageList_RowDeleting" CellPadding="0" CssClass="gv" Width="100%" OnRowDataBound="PageList_RowDataBound" OnRowCommand="PageList_RowCommand" >
                <Columns>
                    <asp:BoundField DataField="OrderId" HeaderText="排序号" >
                        <ControlStyle CssClass="gvOrderId" />
                        <ItemStyle Width="50px" />
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="栏目名称">
                        <EditItemTemplate>
                            &nbsp;
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label5" runat="server" Text='<%# Bind("TitleText") %>'></asp:Label>
                            <asp:HiddenField ID="ParentIdHiddenField" runat="server" Value='<%# Bind("ParentId") %>' />
                        </ItemTemplate>
                        <ItemStyle CssClass="gvLeftField" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="栏目标识">
                        <EditItemTemplate>
                            &nbsp; &nbsp;
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label4" runat="server" Text='<%# Bind("FileName") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="操作" ShowHeader="False">
                        <ItemStyle CssClass="gvCommandField" />
                        <ItemTemplate>
                            <asp:Button ID="EditBt" runat="server" Text="编辑" CausesValidation="false" CommandName="editPage" CommandArgument='<%# Eval("SinglePageId").ToString().Trim() %>' />
                           <asp:Button ID="DelBt" runat="server" CausesValidation="False" CommandName="Delete" Text="删除" />
                            <ajaxToolkit:ConfirmButtonExtender ID="MyConfirmButtonExtender" runat="server" 
                                TargetControlID="DelBt"
                                DisplayModalPopupID="ConfirmModalPopupExtender" />
                            <ajaxToolkit:ModalPopupExtender ID="ConfirmModalPopupExtender" runat="server" 
                                TargetControlID="DelBt"
                                PopupControlID="MpePanel"
                                PopupDragHandleControlID="TitlePanel"
                                CancelControlID="CancelBt"
                                OkControlID="OkBt"
                                BackgroundCssClass="modalBackground" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="添加子栏目">
                        <ItemStyle CssClass="gvBtAField" />
                        <ItemTemplate>
                            <asp:Button ID="AddButton" runat="server" CommandName="addPage" CommandArgument='<%# Eval("SinglePageId").ToString().Trim() %>' Text="添子栏目" CssClass="addBt" CausesValidation="False" />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <RowStyle CssClass="gvRow" />
                <EditRowStyle CssClass="gvEditRow" />
                <PagerStyle CssClass="gvPage" />
                <HeaderStyle CssClass="gvHeader" />
                <AlternatingRowStyle CssClass="gvAlternatingRow" />
            </asp:GridView>
        </ContentTemplate>
     </asp:UpdatePanel>
    <asp:UpdatePanel ID="MenuSaveUpdatePanel" UpdateMode="Conditional" runat="server">
        <ContentTemplate>
            <table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#D7D7D7" id="mainBottTable">
              <tr>
                <td colspan="2" bgcolor="#FFFFFF" class="mainTitle">
                    <asp:Literal ID="SaveType" runat="server" Text="添加"></asp:Literal>子栏目
                    <asp:HiddenField ID="EditId" runat="server" />
                </td>
              </tr>
              <tr>
                <td align="right" bgcolor="#FFFFFF" class="mainContentLeftTd" >
                    所属父栏目:    
                </td>
                <td bgcolor="#FFFFFF" class="mainContentRightTd">
                    <asp:DropDownList ID="ParentIdList" runat="server" ValidationGroup="addEdit">
                    </asp:DropDownList></td>
              </tr>
              <tr>
                <td align="right" bgcolor="#FFFFFF" >
                    子栏目标题:</td>
                <td bgcolor="#FFFFFF" >
                    <asp:TextBox ID="PageTitle" runat="server" ValidationGroup="addEdit"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="PageTitle"
                        Display="Dynamic" ErrorMessage="子栏目标题必须填写" ValidationGroup="addEdit"></asp:RequiredFieldValidator></td>
              </tr>
              <tr>
                <td align="right" bgcolor="#FFFFFF" >
                    子栏目标识:</td>
                <td bgcolor="#FFFFFF">
                    <asp:TextBox ID="FileName" runat="server" ValidationGroup="addEdit"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="FileName"
                        Display="Dynamic" ErrorMessage="子栏目标识必须填写" ValidationGroup="addEdit"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="FileName"
                        Display="Dynamic" ErrorMessage="必须为小写字母或下划线组成" ValidationExpression="[a-z_]{0,30}" ValidationGroup="addEdit"></asp:RegularExpressionValidator>
                    <asp:CustomValidator ID="PageAddCustomValidator" runat="server" ControlToValidate="FileName"
                        Display="Dynamic" ErrorMessage="此标识已经存在" OnServerValidate="PageAddCustomValidator_ServerValidate" ValidationGroup="addEdit"></asp:CustomValidator></td>
              </tr>
              <tr>
                <td align="right" bgcolor="#FFFFFF">
                    栏目排序号:</td>
                <td bgcolor="#FFFFFF">&nbsp;<asp:TextBox ID="OrderId" runat="server" ValidationGroup="addEdit" Text="0" Width="30px"></asp:TextBox>
                    <span class="explain">&nbsp;排序号从小到大排，可以为正负整数</span>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="OrderId"
                        ErrorMessage="排序号必须填写" Display="Dynamic" ValidationGroup="addEdit"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="OrderId"
                        Display="Dynamic" ErrorMessage="排序号应为正负整数" ValidationExpression="[-]{0,1}[0-9]+" ValidationGroup="addEdit"></asp:RegularExpressionValidator>
                </td>
              </tr>
              <tr>
                <td align="right" bgcolor="#FFFFFF" >
                    子栏目内容:</td>
                <td bgcolor="#FFFFFF">&nbsp;
                    </td>
              </tr>
              <tr>
                <td colspan="2" align="left"  bgcolor="#ffffff" >
                    <div class="mainNoLeftTd">
                        <fckeditorv2:fckeditor id="PageContent" runat="server" Height="400px" Width="100%"></fckeditorv2:fckeditor>
                    </div>
                </td>
              </tr>
              <tr>
                <td align="right" bgcolor="#FFFFFF" ></td>
                <td bgcolor="#FFFFFF" >&nbsp;<asp:Button ID="Save" runat="server" Text="添加栏目" CssClass="inputBt" OnClick="Save_Click" ValidationGroup="addEdit"  /></td>
              </tr>
            </table>
        </ContentTemplate>
     </asp:UpdatePanel>
  </div>
</asp:Content>

