思路:
       在控件创建时为每个单元格添加双击事件,并标上单元格的行号与列号。
       鼠标双击某个单元格时,该单元格的行号与列号做为参数传回服务器。
       DataGrid重新绑定时修改对象单元格的值。 
已知问题:当单元格内容带有单引号(')时,内容将会别截断。但是后来输入的不会有这种情况。
那位高人知道怎么解决的话,请一定告诉我。
E-mail:
[email protected] .Aspx文件中添加
//返回行号、列号 
function Dg_dbClick(RowID,ColumnID) 
{ 
window.Form1.action="DbClick.aspx"+"?RowID="+RowID+"&ColumnID="+ColumnID; 
window.Form1.submit(); 
} 
//返回修改后的文本 
function txtCell_OnChange()
 { 
window.Form1.ChangeText.value = window.Form1.txtCell.value; 
}
//文本框KeyPress事件
function txtCell_onkeypress()
{
       //
} 
.Cs文件
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
              if(!Page.IsPostBack)
              {
                   BindData();
              }
              else
              {
                   //行ID
                   string RowID = Request["RowID"] as string;
                   //列ID
                   string ColumnID = Request["ColumnID"] as string;
                   //文本框中的数据
                   string str = Request["ChangeText"] as string;
                   //有行、列ID时才重新绑定
                   if(RowID != "" && ColumnID != "" && str == "" )
                   {
                       BindData2(int.Parse(RowID),int.Parse(ColumnID));
                   }
                   else
                   {
                       //更新程序
                       Label1.Text = str;
                   }
              }
         } 
//双击单元格后重新绑定控件