使Div内内容可编辑
来源:互联网 发布:win7部分软件乱码 编辑:程序博客网 时间:2024/05/21 19:27
前台代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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" >
<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;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GridView1.Style.Add("position", "absolute");
GridView1.DataSource = GetDataSet();
GridView1.DataMember = "testtable";
GridView1.DataBind();
}
}
private DataSet GetDataSet()
{
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));
DataRow dr;
for (int i = 0; i < 10; i )
{
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);
}
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
}
http://luoboqingcai.cnblogs.com/archive/2006/07/01/440514.html
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>- 使Div内内容可编辑
- 使Div内内容可编辑
- 使Div内内容可编辑
- 使Div内内容可编辑
- ASP.NET技巧:使Div内内容可编辑
- 编辑Div内内容
- 使iframe内的内容可编辑
- 让div内可输入内容
- 如何让div内可输入内容
- 内容可编辑且随内容自增长的div
- 怎样使可编辑的DIV固定大小,当内容多时,就自动出现滚动条
- 怎样使可编辑的DIV固定大小,当内容多时,就自动出现滚动条
- 可编辑div中如何在光标位置添加内容
- 可编辑div中指定位置插入内容的方法
- 可编辑div中如何在光标位置添加内容
- DIV可编辑
- 让DIV可编辑
- 使ALV控件中的内容可编辑
- 將datagrid控件內容輸出到excel文件
- 漫谈Ajax在.Net中的使用
- 教你制做Web实时进度条
- 介绍几个ASP.NET中容易忽略但却很重要的方法函数
- 第一次用.net2.0LOGIN登陆控件的困惑和解决方法
- 使Div内内容可编辑
- ASP与ASP.NET互通COOKIES的一点经验
- 同时对多个文件进行大量写操作对性能优化
- 解决ASP.NET中目录访问权限的问题
- access下的分页方案
- asp.net调用存储过程方法新解
- ASP.Net常用功能整理--生成图片的缩略图
- Asp.Net中NHiernate的Session的管理
- .Net2.0原汁原味读取注册表