<%@ page language="C#" masterpagefile="AdminIndexMaster.master" autoeventwireup="true" inherits="Admin_Admin_ShopAddClass, mallz" title="编辑商城栏目" enableviewstate="false" enableEventValidation="false" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
            <asp:FormView ID="FormView1" runat="server" DefaultMode="Insert" Width="100%" DataKeyNames="ClassID" DataSourceID="ObjectDataSource2">
                <InsertItemTemplate>
                    <table class="nick">
                        <tr>
                            <td class="tit" colspan="2">添加分类</td>
                        </tr>
                        <tr>
                            <td class="ltd">
                                所属分类：</td>
                            <td class="rtd">
                                    <asp:DropDownList ID="DropParentID" runat="server" DataSourceID="ObjectDataSource1" OnDataBound="DropParentID_OnDataBound" AppendDataBoundItems="True" DataValueField="ClassID" DataTextField="ClassName" SelectedValue='<%#Bind("ParentID") %>' Width="400">
                                        <asp:ListItem Value="0">顶级分类</asp:ListItem>
                                    </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td class="ltd">
                                分类名称：</td>
                            <td class="rtd">
                                <asp:TextBox ID="ClassName" runat="server" Width="300px" Text='<%#Bind("ClassName") %>' />
                                <asp:RequiredFieldValidator ID="dd" runat="server" ErrorMessage="分类名称不能为空" ControlToValidate="ClassName" />
                                </td>
                        </tr>
                        <tr>
                            <td class="ltd">
                                分类目录名：</td>
                            <td class="rtd">
                                <asp:TextBox ID="TextClassDir" runat="server" Width="200px" Text='<%#Bind("ClassDir") %>' onkeyup="if((/[\W]/g).test(value)){alert('只能用英文！');value=value.replace(/[\W]/g,'');}" />
                                 （只能用英文，网站启用静态化时用于生成文件，添加后不能修改）
				<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="TextClassDir" runat="server" ErrorMessage="目录不能空"></asp:RequiredFieldValidator>
				</td>
                        </tr>
                        <tr>
                            <td class="ltd">
                                分类名称首字母：</td>
                            <td class="rtd">
                                <asp:TextBox ID="TextBox2" runat="server" Width="200px" Text='<%#Bind("Initials") %>' onkeyup="if((/[\W]/g).test(value)){alert('只能用英文！');value=value.replace(/[\W]/g,'');}"  /> </td>
                        </tr>
                        <tr>
                            <td class="ltd">
                                分类开放状态：</td>
                            <td class="rtd">
                                <asp:CheckBox ID="CheckBox1" runat="server" Text="开放" Checked='<%#Bind("EnableAdd") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="ltd">
                                是否前台显示：</td>
                            <td class="rtd">
                                <asp:CheckBox ID="CheckBox2" runat="server" Text="显示" Checked='<%#Bind("ShowOnIndex") %>' />
                            </td>
                        </tr>                        
                        <tr>
                            <td class="ltd">
                                分类提示：</td>
                            <td class="rtd">
                                <asp:TextBox ID="ClassTips" runat="server" TextMode="MultiLine" Width="500px" Height="100px" Text='<%#Bind("Tips") %>' /> 不支持 HTML</td>
                        </tr>
                        <tr>
                            <td class="ltd">
                                分类说明：</td>
                            <td class="rtd">
                                <asp:TextBox ID="ReadMe" runat="server" TextMode="MultiLine" Width="500px" Height="100px" Text='<%#Bind("ReadMe") %>' /> 支持 HTML</td>
                        </tr>                       
                         <tr>
                            <td class="ltd">
                                分类所属专题：</td>
                            <td class="rtd">
                                <asp:DropDownList ID="ClassSpecial" runat="server" DataSourceID="ObjectDataSource5"
                                    DataTextField="SpecialName" DataValueField="SpecialID" SelectedValue='<%# Bind("SpecialID") %>' AppendDataBoundItems="true">
                                    <asp:ListItem Text="不属于任何专题" Value="-1" />
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td class="ltd">分类下商品风格：</td>
                            <td class="rtd">
                                <asp:DropDownList ID="ProductSkinID" runat="server" DataSourceID="ObjectDataSource4" DataTextField="SkinName" DataValueField="SkinID" SelectedValue='<%# Bind("ProductSkinID") %>' >
                                    <asp:ListItem Value="-1" Text="不属于任何风格" /> 
                                </asp:DropDownList>
                            </td>
                        </tr>                       
                        <tr>
                            <td class="ltd">
                                默认每页显示商品数量：</td>
                            <td class="rtd">
                                <asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("MaxPerPage") %>'>
                                    <asp:ListItem Text="20" Value="20"  />
                                    <asp:ListItem Text="40" Value="40" />
                                    <asp:ListItem Text="80" Value="80" />
                                </asp:DropDownList>
                            </td>
                        </tr>
                         <tr>
                            <td class="ltd">
                                列表显示形式：</td>
                            <td class="rtd">
                                <asp:DropDownList ID="DropDownList2" runat="server" SelectedValue='<%# Bind("ItemListOrderType") %>' onchange="if(this.value=='2'){document.getElementById('ShowPicSize').style.display=''}else{document.getElementById('ShowPicSize').style.display='none'};">
                                    <asp:ListItem Text="图文列表" Value="1"  />
                                    <asp:ListItem Text="方块图文" Value="2" />
                                    <asp:ListItem Text="文字列表" Value="3" />
                                </asp:DropDownList>
                            </td>
                        </tr>
                         <tr id="ShowPicSize" style="display:none;">
                            <td class="ltd">
                                显示图片大小规格：</td>
                            <td class="rtd">
                                <asp:DropDownList ID="DropDownList3" runat="server" SelectedValue='<%# Bind("ItemOpenType") %>'>                                    
                                    <asp:ListItem Text="120 X 120" Value="1" />
                                    <asp:ListItem Text="220 X 220" Value="2"  />
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="text-align:center">
                                <asp:Button ID="AddChannel" Text="添 加" CausesValidation="true" CommandName="Insert" runat="server" />
                                <input type="button" onclick="history.back()" value="返 回" />
                            </td>
                        </tr>
                    </table>
                </InsertItemTemplate>
                <EditItemTemplate>
                    <table class="nick">
                        <tr>
                            <td class="tit" colspan="2">修改分类</td>
                        </tr>
                        <tr>
                            <td class="ltd">
                                所属分类：</td>
                            <td class="rtd">
                                    <asp:DropDownList ID="DropParentID" Enabled="false" runat="server" DataSourceID="ObjectDataSource1" AppendDataBoundItems="True" DataValueField="ClassID" DataTextField="ClassName" SelectedValue='<%# Eval("ParentID") %>' Width="400">
                                        <asp:ListItem Value="0">顶级分类</asp:ListItem>
                                    </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td class="ltd">
                                分类名称：</td>
                            <td class="rtd">
                                <asp:TextBox ID="ClassName" runat="server" Width="300px" Text='<%#Bind("ClassName") %>' />
                                <asp:RequiredFieldValidator ID="dd" runat="server" ErrorMessage="分类名称不能为空" ControlToValidate="ClassName" />
                                </td>
                        </tr>
                        <tr>
                            <td class="ltd">
                                分类目录名：</td>
                            <td class="rtd">
                                <asp:TextBox ID="TextBox1" runat="server" Width="200px" Text='<%#Bind("ClassDir") %>' Enabled="false" onkeyup="if((/[\W]/g).test(value)){alert('只能用英文！');value=value.replace(/[\W]/g,'');}"  /> </td>
                        </tr>
                        <tr>
                            <td class="ltd">
                                分类名称首字母：</td>
                            <td class="rtd">
                                <asp:TextBox ID="TextBox2" runat="server" Width="200px" Text='<%#Bind("Initials") %>' onkeyup="if((/[\W]/g).test(value)){alert('只能用英文！');value=value.replace(/[\W]/g,'');}"  /> </td>
                        </tr>
                        <tr>
                            <td class="ltd">
                                分类开放状态：</td>
                            <td class="rtd">
                                <asp:CheckBox ID="CheckBox1" runat="server" Text="开放" Checked='<%#Bind("EnableAdd") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="ltd">
                                是否前台显示：</td>
                            <td class="rtd">
                                <asp:CheckBox ID="CheckBox2" runat="server" Text="显示" Checked='<%#Bind("ShowOnIndex") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="ltd">
                                分类提示：</td>
                            <td class="rtd">
                                <asp:TextBox ID="ClassTips" runat="server" Width="500px" Height="100" TextMode="MultiLine" Text='<%#Bind("Tips") %>' /> 不支持 HTML</td>
                        </tr>
                        <tr>
                            <td class="ltd">
                                分类说明：</td>
                            <td class="rtd">
                                <asp:TextBox ID="ReadMe" runat="server" Width="500px" Height="100" TextMode="MultiLine" Text='<%#Bind("ReadMe") %>' /> 支持 HTML</td>
                        </tr>                      
                         <tr>
                            <td class="ltd">
                                分类所属专题：</td>
                            <td class="rtd">
                                <asp:DropDownList ID="ClassSpecial" runat="server" DataSourceID="ObjectDataSource5"
                                    DataTextField="SpecialName" DataValueField="SpecialID" SelectedValue='<%# Bind("SpecialID") %>' AppendDataBoundItems="true">
                                    <asp:ListItem Text="不属于任何专题" Value="-1" />
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td class="ltd">
                                分类下商品风格：</td>
                            <td class="rtd">
                                <asp:DropDownList ID="ProductSkinID" runat="server" DataTextField="SkinName" DataValueField="SkinID" AppendDataBoundItems="true"
                                    SelectedValue='<%# Bind("ProductSkinID") %>' DataSourceID="ObjectDataSource4" >
                                      <asp:ListItem Text="不属于任何风格" Value="-1" />
                                      </asp:DropDownList>
                                风格应用于所有子类：<asp:CheckBox ID="ChildClassUseSkin" runat="server" /> 是
                            </td>
                        </tr>                     
                         <tr>
                            <td class="ltd">
                                默认每页显示商品数量：</td>
                            <td class="rtd">
                                <asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("MaxPerPage") %>'>
                                    <asp:ListItem Text="20" Value="20"  />
                                    <asp:ListItem Text="40" Value="40" />
                                    <asp:ListItem Text="80" Value="80" />
                                </asp:DropDownList>
                            </td>
                        </tr>
                         <tr>
                            <td class="ltd">
                                显示形式：</td>
                            <td class="rtd">
                                <asp:DropDownList ID="DropDownList2" runat="server" SelectedValue='<%# Bind("ItemListOrderType") %>' onchange="if(this.value=='2'){document.getElementById('ShowPicSize').style.display=''}else{document.getElementById('ShowPicSize').style.display='none'};">
                                    <asp:ListItem Text="图文列表" Value="1"  />
                                    <asp:ListItem Text="方块图文" Value="2" />
                                    <asp:ListItem Text="文字列表" Value="3" />
                                </asp:DropDownList>
                            </td>
                        </tr>
                         <tr id="ShowPicSize" style="display:none;">
                            <td class="ltd">
                                显示图片大小规格：</td>
                            <td class="rtd">
                                <asp:DropDownList ID="DropDownList3" runat="server" SelectedValue='<%# Bind("ItemOpenType") %>'>
                                    <asp:ListItem Text="120X120" Value="1"  />
                                    <asp:ListItem Text="220X220" Value="2" />
                                    
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="text-align: center;">
                                <asp:Button ID="UpdateChannel" Text=" 保 存 " CausesValidation="true" CommandName="update" runat="server" />
                                    <asp:Button ID="cl" runat="server" OnClientClick="javascript:{history.back();return false;}" Text=" 取 消 " />
                            </td>
                        </tr>
                    </table>
                    <asp:HiddenField ID="H_ClassParentPath" runat="server" Value='<%#Eval("ParentPath") %>' />
                </EditItemTemplate>
            </asp:FormView>
            
            <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" InsertMethod="InsertClass" SelectMethod="GetClassByClassID" TypeName="MallZ.Data.Shop_Class" UpdateMethod="UpdateShopClass" OldValuesParameterFormatString="original_{0}" OnInserted="ObjectDataSource2_OnInserted" OnUpdated="ObjectDataSource2_OnUpdated" OnInserting="ObjectDataSource2_Inserting" OnUpdating="ObjectDataSource2_Updating">
                <InsertParameters>
                    <asp:Parameter Name="SpecialID" Type="Int32" />
                    <asp:Parameter Name="ClassName" Type="String" />
                    <asp:Parameter Name="ClassType" Type="Int32" />
                    <asp:Parameter Name="OpenType" Type="Int32" />
                    <asp:Parameter Name="ParentID" Type="Int32" DefaultValue="0" />
                    <asp:Parameter Name="Tips" Type="String" DefaultValue="" ConvertEmptyStringToNull="false"/>
                    <asp:Parameter Name="ReadMe" Type="String" DefaultValue="" ConvertEmptyStringToNull="false"/>
                    <asp:Parameter Name="ShowOnTop" Type="Boolean" />
                    <asp:Parameter Name="ShowOnIndex" Type="Boolean" />
                    <asp:Parameter Name="ItemListOrderType" Type="Int32" />
                    <asp:Parameter Name="IsElite" Type="Boolean" />
                    <asp:Parameter Name="EnableAdd" Type="Boolean" />
                    <asp:Parameter Name="MaxPerPage" Type="Int32" />
                    <asp:Parameter Name="ItemOpenType" Type="Int32" />
                    <asp:Parameter Name="ClassDir" Type="String" />
                    <asp:Parameter Name="TemplateID" Type="Int32" />
                    <asp:Parameter Name="ClassSkinID" Type="Int32" />
                    <asp:Parameter Name="ProductTemplateID" Type="Int32" />
                    <asp:Parameter Name="ProductSkinID" Type="String" DefaultValue="-1" />
                    <asp:Parameter Name="Initials" Type="String" DefaultValue="" ConvertEmptyStringToNull="false" />
                </InsertParameters>
                <UpdateParameters>
                    <asp:Parameter Name="SpecialID" Type="Int32" />
                    <asp:Parameter Name="ClassName" Type="String" />
                    <asp:Parameter Name="Tips" Type="String" DefaultValue="" ConvertEmptyStringToNull="false"/>
                    <asp:Parameter Name="ReadMe" Type="String" DefaultValue="" ConvertEmptyStringToNull="false" />
                    <asp:Parameter Name="ShowOnTop" Type="Boolean" />
                    <asp:Parameter Name="ShowOnIndex" Type="Boolean" />
                    <asp:Parameter Name="IsElite" Type="Boolean" />
                    <asp:Parameter Name="EnableAdd" Type="Boolean" />
                    <asp:Parameter Name="ItemListOrderType" Type="Int32" />
                    <asp:Parameter Name="MaxPerPage" Type="Int32" />
                    <asp:Parameter Name="ItemOpenType" Type="Int32" />
                    <asp:Parameter Name="ClassDir" Type="String" />
                    <asp:Parameter Name="TemplateID" Type="Int32" />
                    <asp:Parameter Name="ClassSkinID" Type="Int32" />
                    <asp:Parameter Name="ProductTemplateID" Type="Int32" />
                    <asp:Parameter Name="ProductSkinID" Type="String" />
                    <asp:Parameter Name="ChildClassUseSkin" Type="Boolean" />
                    <asp:Parameter Name="Initials" Type="String" DefaultValue="" ConvertEmptyStringToNull="false" />
                </UpdateParameters>
                <SelectParameters>
                    <asp:QueryStringParameter DefaultValue="0" Name="ClassID" QueryStringField="ClassID" Type="Int32" />
                </SelectParameters>
            </asp:ObjectDataSource>
            
            <asp:ObjectDataSource ID="ObjectDataSource4" runat="server" SelectMethod="GetProSkinBySkinType"
                TypeName="MallZ.Data.SkinBll">
                <SelectParameters>
                    <asp:Parameter ConvertEmptyStringToNull="true" Name="SkinType" Type="String" DefaultValue="Product" />
                </SelectParameters>
            </asp:ObjectDataSource>
            <asp:ObjectDataSource ID="ObjectDataSource5" runat="server" SelectMethod="GetSpecialByID"
                TypeName="MallZ.Data.SpecialBll">
                <SelectParameters>
                    <asp:Parameter Name="SpecialID" Type="Int32" DefaultValue="-1" />
                </SelectParameters>
            </asp:ObjectDataSource>
            
        <asp:ObjectDataSource ID="ObjectDataSource1" TypeName="MallZ.Data.Shop_Class" SelectMethod="GetAllClassNameFillDropDown" runat="server"></asp:ObjectDataSource>
</asp:Content>
