【Help】DataGrid中如何做到在客户端可调整列的宽度? 建议在后台代码的页面加载事件中输出客户端脚本脚本内为DataGrid在客户端的html标记(有Table的,可以查看输出网页的源代码)增加客户端事件 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/dhtml_reference_entry.asp用js,参考一下上面的dhtml吧。 呵呵建议到微创crm软件去看一下别人怎么做的,网址:http://210.22.110.194/crm/login.aspx?ReturnUrl=%2fcrm%2fdefault.aspx账号:adas 密码:aaa111里面就有控制datagrid列的方法。 再推,楼上的东东很好,可惜没有找到控制Datagrid列的方法:( datagrid在客户端就是table,试试下面的代码<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>table</title><SCRIPT LANGUAGE="JavaScript"><!--var startx=0;var mousePress=false;var destElm;var oldWidth=40;function down(){startx = event.x;mousePress=true;with (event.srcElement) destElm = parentNode.cells[cellIndex-1]oldWidth = destElm.offsetWidth;}function up(){mousePress=false;}function move(){if (!mousePress) return;var d=event.x-startx+oldWidth;if (d>0) destElm.width=d;}//--></SCRIPT><style>.left {border-left:1px solid black}.top {border-top:1px solid black}.left-top {border-top:1px solid black;border-left:1px solid black}TABLE{border:1px solid black}</style></head><body onmouseup=up() onmousemove=move()><table><tr><td>IPC</td><td onmousedown=down() style="CURSOR: e-resize"></td><td class=left>IPC</td><td onmousedown=down() style="CURSOR: e-resize"></td><td class=left>IPC</td><td onmousedown=down() style="CURSOR: e-resize"></td><td class=left>IPC</td><td onmousedown=down() style="CURSOR: e-resize"></td></tr><tr><td class=top>fgqa</td><td onmousedown=down() style="CURSOR: e-resize"></td><td class=left-top>fgqa</td><td onmousedown=down() style="CURSOR: e-resize"></td><td class=left-top>fgqa</td><td onmousedown=down() style="CURSOR: e-resize"></td><td class=left-top>fgqa</td><td onmousedown=down() style="CURSOR: e-resize"></td></tr><tr><td class=top>fgqa</td><td onmousedown=down() style="CURSOR: e-resize"></td><td class=left-top>fgqa</td><td onmousedown=down() style="CURSOR: e-resize"></td><td class=left-top>fgqa</td><td onmousedown=down() style="CURSOR: e-resize"></td><td class=left-top>fgqa</td><td onmousedown=down() style="CURSOR: e-resize" ></td></tr></table><INPUT style="CURSOR: e-resize" onmousedown=down() id=button1 type=button value=Button name=button1></body></html> to:mynewpc(水中日月)是上好东东收藏! 为什么不能正确执行页面跳转? 插不进数据...求助 新手求教:我的WEB页面有个IMAGE,别的机器访问为什么看不到?? 乱码.DataGrid. 在程序写可以,但配置在web.config就不行。 简单的html的label控件问题,js经验多的进来帮帮忙? 请问大家WEB打印都是用什么方式,实现的,感觉如何 有后台代码有页面代码,但没有工程文件,怎么样导入到自己的工程中呀,不会是拷贝吧 ASP.NET 如何将导航做成动态的?(需要从读取数据库数据) 急招asp.net高手 ASP.NET发布问题??????????????????????????????? 弱智的问题,请高手帮忙
账号:adas 密码:aaa111
里面就有控制datagrid列的方法。
楼上的东东很好,可惜没有找到控制Datagrid列的方法:(
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>table</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
var startx=0;
var mousePress=false;
var destElm;
var oldWidth=40;
function down()
{
startx = event.x;
mousePress=true;
with (event.srcElement)
destElm = parentNode.cells[cellIndex-1]
oldWidth = destElm.offsetWidth;
}
function up()
{
mousePress=false;
}
function move()
{
if (!mousePress) return;
var d=event.x-startx+oldWidth;
if (d>0) destElm.width=d;
}
//-->
</SCRIPT>
<style>
.left {border-left:1px solid black}
.top {border-top:1px solid black}
.left-top {border-top:1px solid black;border-left:1px solid black}
TABLE{border:1px solid black}
</style>
</head>
<body onmouseup=up() onmousemove=move()>
<table>
<tr>
<td>IPC</td><td onmousedown=down() style="CURSOR: e-resize"></td>
<td class=left>IPC</td><td onmousedown=down() style="CURSOR: e-resize"></td>
<td class=left>IPC</td><td onmousedown=down() style="CURSOR: e-resize"></td>
<td class=left>IPC</td><td onmousedown=down() style="CURSOR: e-resize"></td>
</tr>
<tr>
<td class=top>fgqa</td><td onmousedown=down() style="CURSOR: e-resize"></td>
<td class=left-top>fgqa</td><td onmousedown=down() style="CURSOR: e-resize"></td>
<td class=left-top>fgqa</td><td onmousedown=down() style="CURSOR: e-resize"></td>
<td class=left-top>fgqa</td><td onmousedown=down() style="CURSOR: e-resize"></td>
</tr>
<tr>
<td class=top>fgqa</td><td onmousedown=down() style="CURSOR: e-resize"></td>
<td class=left-top>fgqa</td><td onmousedown=down() style="CURSOR: e-resize"></td>
<td class=left-top>fgqa</td><td onmousedown=down() style="CURSOR: e-resize"></td>
<td class=left-top>fgqa</td><td onmousedown=down() style="CURSOR: e-resize"
></td>
</tr>
</table><INPUT style="CURSOR: e-resize" onmousedown=down() id=button1 type=button value=Button name=button1></body>
</html>
收藏!