一、使用asp.net 自带的form;
二、用div代替asp.net 自带的form;
一、使用asp.net 自带的form;
由于aspx页面的特殊性,class='easyui-layout'如果直接放在body上,用div作region,会因为中间间隔著名的<form id="form1" runat="server" >服务器控件,而出现缺失节点的错误;
目前可行的方法是把class='easyui-layout'放到<form id="form1" runat="server" >服务器控件内,同时,让form自动适应body的高宽;
具体操作为,取window的高宽,设置给form;
其中,为了给body四周留出一定的margin,取出的window高宽各减去10,同时把body的margin:5px;
- //窗口自适应调整
- $(function() {
- windowResize(); //文档载入时加载
- $(window).resize(function() {
- windowResize(); //窗口改变大小时加载
- });
- });
- function windowResize() {
- var width = $(window).width()-10; //减去10与body中margin:5px共同作用:为body留的边距
- var height = $(window).height()-10;
- // $('form#form1').width(width);
- // $('form#form1').height(height);
- // $('form#form1').layout(); //相当于<form id='form1' class='easyui-layout' runat="server">
- $('#autoFitWindow').width(width);
- $('#autoFitWindow').height(height);
- $('#autoFitWindow').layout(); //相当于<form id='form1' class='easyui-layout' runat="server">
- }