呵呵,仅IE有效:) <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“> <html xmlns=”http://www.w3.org/1999/xhtml” > public partial class _Default : System.Web.UI.Page private DataSet GetDataSet() DataRow dr; for (int i = 0; i < 10; i++) DataSet ds = new DataSet(); http://luoboqingcai.cnblogs.com/archive/2006/07/01/440514.html
前台代码:
<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”Default.aspx.cs” Inherits=”_Default” %>
<head runat=”server”>
<title>无标题页</title>
</head>
<body>
<form id=”form1″ runat=”server”>
<div style=”width:600px;height:400px;” id=”div1″>
<asp:GridView ID=”GridView1″ runat=”server” Height=”300px” Width=”200px”>
</asp:GridView>
</div>
<script language=”javascript” type=”text/javascript”>
document.getElementById(“div1”).contentEditable = true;
document.execCommand(2D-Position, true, true);
</script>
</form>
</body>
</html>后台代码:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GridView1.Style.Add(“position”, “absolute”);
GridView1.DataSource = GetDataSet();
GridView1.DataMember = “testtable”;
GridView1.DataBind();
}
}
{
DataTable dt = new DataTable(“testtable”);
dt.Columns.Add(“Col1”, typeof(int));
dt.Columns.Add(“Col2”, typeof(string));
dt.Columns.Add(“Col3”, typeof(string));
dt.Columns.Add(“Col4”, typeof(string));
{
dr = dt.NewRow();
dr[0] = i;
dr[1] = “Val” + i.ToString();
dr[2] = “Val” + i.ToString();
dr[3] = “Val” + i.ToString();
dt.Rows.Add(dr);
}
ds.Tables.Add(dt);
return ds;
}
}
使div内内容可编辑_asp.net技巧
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 使div内内容可编辑_asp.net技巧
相关推荐
-      对.net framework 反射的反思_asp.net技巧
-      .net3.5和vs2008中的asp.net ajax_asp.net技巧
-      使用asp.net ajax框架扩展html map控件_asp.net技巧
-      asp.net应用程序资源访问安全模型_asp.net技巧
-      photoshop初学者轻松绘制螺旋漩涡特效_photoshop教程
-      photoshop通道结合图层模式抠狗尾巴草_photoshop教程
-      web.config详解+asp.net优化_asp.net技巧
-      asp.net中多彩下拉框的实现_asp.net技巧