<%@ Page Language="C#" MasterPageFile="~/Member/UserManage.master" AutoEventWireup="true"
    CodeFile="ProTypeList.aspx.cs" Inherits="Member_ProType_ProTypeList" Title="管理自定义分类" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContInfo" runat="Server">

    <script type="text/ecmascript">
        function SelectAll()
        {
            // 找到所有的 input 元素
            var ctllist = document.getElementsByTagName("input");
            var objcheckbox= document.getElementById("CheckBox2");     
            for( var i = 0; i< ctllist.length; i++)
            {
                if(ctllist[i].type == "checkbox" && ctllist[i].name.indexOf( "CheckBox1") >=0 )
                {   
                    if(objcheckbox.checked==true)     
                         ctllist[i].checked = true;
                    else
                         ctllist[i].checked = false;
                }
          
             }
         }
    </script>
<div id="sub_content"> 
    <div class="pagetitle">
        管理自定义分类</div>
    <div class="main_Supply_nav">
        <ul>
            <li class="MenuLiCheck">自定义分类管理</li></ul>
    </div>
	<div class="clr"></div>
    <table cellpadding="0" cellspacing="0" border="0" width="795">
        <tr>
            <td height="35">
                添加分类:<asp:TextBox ID="TxtProTypeName" runat="server"></asp:TextBox>&nbsp;&nbsp;<asp:Button
                    ID="btnSave" runat="server" Text="确定" OnClick="btnSave_Click" CssClass="i_button" />
            </td>
        </tr>
    </table>
    <asp:DataList ID="dlstProType" runat="server" DataKeyField="ID" OnCancelCommand="dlstProType_CancelCommand"
        OnDeleteCommand="dlstProType_DeleteCommand" OnEditCommand="dlstProType_EditCommand"
        OnUpdateCommand="dlstProType_UpdateCommand" RepeatColumns="1" Width="795" CssClass="table_main1">
        <HeaderTemplate>
            <tr>
                <th>
                    选项
                </th>
                <th>
                    排序</th>
                <th>
                    名称</td>
                    <th>
                        操作</th>
            </tr>
        </HeaderTemplate>
        <ItemTemplate>
            <tr>
                <td>
                    <asp:CheckBox ID="CheckBox1" runat="server" />
                </td>
                <td>
                    <asp:TextBox ID="txtSequence" runat="server" Text='<%# Eval("Sequence") %>' onblur="IsNum(this);"
                        CssClass="i_corp"></asp:TextBox>
                    <asp:Label ID="Lb_id" runat="server" Text='<%#Eval("ID")%>' Visible="false"></asp:Label>
                </td>
                <td>
                    <%#Eval("Name")%>
                </td>
                <td>
                    〖<asp:LinkButton ID="lbtnEdit" runat="server" CommandName="edit">编辑</asp:LinkButton>
                    <asp:LinkButton ID="lbtnDelete" runat="server" CommandName="delete" OnClientClick="return confirm('你确定要删除吗?')"
                        Text="删除"></asp:LinkButton>〗</td>
            </tr>
        </ItemTemplate>
          <EditItemTemplate>
            <tr>
                <td>
                    <asp:CheckBox ID="CheckBox1" runat="server" />
                </td>
                <td>
                    <asp:TextBox ID="txtSequence" runat="server" Text='<%# Eval("Sequence") %>' onblur="IsNum(this);"
                        CssClass="i_corp"></asp:TextBox>
                </td>
                <td style="background-color: #f8f8f8;" class="thname">
                    <asp:TextBox ID="txtName" runat="server" Text='<%# Eval("Name")%>'></asp:TextBox></td>
                <td style="background-color: #f8f8f8;" class="thcaozuo">
                    <asp:LinkButton ID="btnUpdate" runat="server" CommandName="update">更新</asp:LinkButton>
                    <asp:LinkButton ID="btnCancel" runat="server" CommandName="cancel">取消</asp:LinkButton></td>
            </tr>
        </EditItemTemplate>
    </asp:DataList>
    <table>
        <tr>
            <td>
                <div class="paging">
                    <p>
                        <asp:Label ID="lblMessage" runat="server" Text="Label" Visible="False"></asp:Label>
                        <asp:LinkButton ID="LinkButton1" runat="server" Text="排序" OnClick="LinkButton1_Click"></asp:LinkButton>
                        <asp:Label ID="Pagin" runat="server"></asp:Label>
                    </p>
                    <input id="CheckBox2" name="CheckBox2" onclick="SelectAll();" type="checkbox" />全选
                    <asp:Button ID="btnDelete" runat="server" Font-Size="9pt" OnClick="btnDelete_Click"
                        Text="批量删除" />
                </div>
            </td>
        </tr>
    </table>
   </div>
    <script type="text/javascript" src="../../js/Common.js"></script>

    <script type="text/javascript">
    $("ctl00_ContInfo_btnSave").onclick=function()
    {
    if($("ctl00_ContInfo_TxtProTypeName").value.replace(/\s/g,'')=="")
      {
        alert("添加分类不能为空!")
        $("ctl00_ContInfo_TxtProTypeName").focus();
        return false;
      }
    }
    function IsNum(obj)
	   {
		 var vlu=obj.value.replace(/\D/g,'');
		 if(obj.value!=vlu)
		 {
		  alert("输入的必须都为整数");
		  obj.focus();
		  }
		 return false;
	   }
    </script>

</asp:Content>
