<%@ Page Language="C#" AutoEventWireup="true" Codebehind="setMyType.aspx.cs" Inherits="ZYDN.Web.system.Label.setMyType" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <link rel="stylesheet" type="text/css" href="../skins/css/main.css" />
    <title>设置自定义分类</title>
    <script language="javascript" src="../js/JFramework.js"></script>
	<script language="javascript" src="../js/Sys.js"></script>
    <base target="_self" />
    <script type="text/javascript" language="javascript">
    	var objAjax=new JAjax();
    	
    	
        function  delType(obj){
           var id=obj.id.replace(/DEL/g,"");
           	
           var objResponse=new JHttpResponse();
	       objResponse.write("ID",id);
           var out=objAjax.getText("post","labelSever.aspx?type=delMyType",objResponse,null);
          // alert(out);
            //location.reload();
            //location.href="setMyType.aspx?t="+create_id();
            $("div"+id).outerHTML="";

        }
    
    	
        function  upDataType(obj){
           var id=obj.id.replace(/UP/g,"");
           	
           var objResponse=new JHttpResponse();
	       objResponse.write("ID",id);
	       objResponse.write("typeName",$("t"+id).value);
           var out=objAjax.getText("post","labelSever.aspx?type=upDataMyType",objResponse,null);
           if (out=="1"){
            alert("更新成功");
           }else{
             alert(out);
           }
            //location.reload();
            //location.href="setMyType.aspx?t="+create_id();
         //   $("div"+id).outerHTML="";

        }
    
    </script>
    
</head>
<body>
    <form id="form1" runat="server" style="padding: 8px;">
        <div>
            <asp:Repeater ID="myTypeList" runat="server">
                <ItemTemplate>
                    <div id="div<%# DataBinder.Eval(Container, "DataItem.id")%>">
                        <input id="t<%# DataBinder.Eval(Container, "DataItem.id")%>" value="<%# DataBinder.Eval(Container, "DataItem.typeName")%>" <%# DataBinder.Eval(Container, "DataItem.typeName")%>>
                        <input id="DEL<%# DataBinder.Eval(Container, "DataItem.id")%>" type="button"  value="删除" onclick="delType(this)"/>
                        <input id="UP<%# DataBinder.Eval(Container, "DataItem.id")%>" type="button" value="更新" onclick="upDataType(this)"/>
                     </div>
                </ItemTemplate>
            </asp:Repeater>
        </div>
        <div>
            添加新的分类 :
            <asp:TextBox ID="newTypeName" runat="server" Style="width: 120px;"></asp:TextBox>
            <asp:Button ID="saveButton" runat="server" Text="提交" OnClick="saveButton_Click" /></div>
    </form>
</body>
</html>
