<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Unit.aspx.cs" Inherits="XpShop.Manage.Unit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML>
	<HEAD>
	    <meta http-equiv="content-type" content='text/html;charset=utf-8'/>
		<title>单位管理</title>
		<link rel="stylesheet" href="style/main.css" type="text/css"/>
        <link href="inc/jqgrid/css/jquery-ui-1.7.1.custom.css" rel="stylesheet" type="text/css" />
        <link href="inc/jqgrid/css/ui.jqgrid.css" rel="stylesheet" type="text/css" />
        <link href="inc/jqgrid/css/ui.multiselect.css" rel="stylesheet" type="text/css" />
        <link href="inc/popup/jquery.popup.css" rel="stylesheet" type="text/css" />
        <script src="inc/jqgrid/jquery-1.4.2.min.js" type="text/javascript"></script>
        <script src="inc/jqgrid/grid.locale-cn.js" type="text/javascript"></script>        
        <script src="inc/jqgrid/jquery.jqGrid.min.js" type="text/javascript"></script>
        <script src="inc/popup/jquery.popup.js" type="text/javascript"></script>
        <script src="inc/pngpic.js" type="text/javascript"></script>
        <script src="inc/commond.js" type="text/javascript"></script>
        <script type="text/javascript">
        $(document).ready(function(){
            var ph = $(window.parent.frames.right).height()-$('div.sub_container_title').height()-100;
            $("#list").jqGrid({
            url: 'ajax.ashx?nocopyright=1&Action=GetUnits',//地址文件
                datatype: "json",
                colNames: ['操作','单位编号', '单位','排序','添加时间','创建人'],//这里是显示的数据库表的字段名称
                colModel: [
                            {name:'act',index:'act',width:110,search:false,sortable:false,editable:false},
                            {name: 'UID', index: 'UID', width: 50},
                            {name: 'UName', index: 'UName', width: 50},
                            {name: 'Sort', index: 'Sort', width: 50},
                            {name: 'AddTime', index: 'AddTime', width: 50}, 
                            {name: 'Creator', index: 'Creator', width: 50},                        
                           ],//这里是数据读取到的字段列名
            rowNum: 10,
            rowList: [10, 20, 30],
            pager: '#pager',
            multiselect: true,
            sortname: 'UID',
            viewrecords: true,
            sortorder: "desc",            
            height:ph,
            autowidth:true,
            gridComplete: function(){
                var ids = $("#list").getDataIDs();//jqGrid('getDataIDs');
                for(var i=0;i<ids.length;i++){
                    var cl = ids[i];
                    be = "<input style='height:22px;width:40px;' type='button' value='编辑1' onclick=\"jQuery('#list').jqGrid('editGridRow','"+cl+"',{checkOnSubmit:true,checkOnUpdate:true,closeAfterEdit:true,closeOnEscape:true});\"  />"; 
                    de = "<input style='height:22px;width:40px;' type='button' value='删除1' onclick=\"jQuery('#list').jqGrid('delGridRow','"+cl+"',{closeOnEscape:true});\"  />";
                    jQuery("#list").jqGrid('setRowData',ids[i],{act:be+de});
                } 
            }
            }).navGrid("#pager", { edit: true, add: false, del: true });
            $("#btnAdd").click(function(){
				 parent.$.fn.popup({iframe:true,url:'http://www.baidu.com',title:'百度',type:9,width:500,height:500});
            });
            $("#btnDelete").click(function(){
				alert($("#list").getGridParam("selarrrow"));
            });
     });
    </script>
	</HEAD>
	<body>	    
    <div class="container">
		<div class="sub_container">
		    <div class="sub_container_title"><a href="<%=AdminDefault%>" target="_top">桌面</a><img src="images/admin_title.jpg" height=9px width=8px align="absmiddle" />
		        <% if(Request.QueryString["UID"] == null) {%>单位列表<% }else{%>单位添加<% }%>
		    </div>
		    <div class="sub_container_operation">
				<ul>
					<li><input type="button" id="btnAdd" value="添加" class="inputbtn" /></li>
				    <li><input type="button" id="btnDelete" value="删除" class="inputbtn" /></li>
				</ul>
		    </div>
		    <div class="clear"></div>
		    <div class="sub_container_content" style="padding:0px;">
		        <table id="list" class="scroll" cellpadding="0" cellspacing="0"></table>
                <div id="pager" class="scroll" style="text-align: center;"></div>
		    </div>
		</div>
	</div>
	</body>
</HTML>