怎样获取DataGrid的第一行某一列的值 <script>var tr=document.all("your_data_grid_id").children(0).children(0);alert(tr.children(0).innerText);</script> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 WinForm:private int position_x;private int position_y;private void Form_Load(object sender,EventArgs e){DataSet ds=new DataSet();...dataGrid1.DataSource=ds.Tables[0];DataGridCell c=new DataGridCell(0,0);Rectangle rc=this.dataGrid1.GetCellBounds(c);position_x=rc.Left;position_y=rc.Top;}//下面的方法取得第一行某一列的值private string GetValueAtFirstRow(int ColumnIndex){DataGrid.HitTestInfo hti=dataGrid1.HitTest(position_x,position_y);return dataGrid1[hti.Row,ColumnIndex].ToString());}当然,如果你重新设置了RowHeaderWidth或者会影响第一行在DataGrid位置的其他属性,你必须重新设置position_x和position_y string strDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=tian.mdb"; OleDbConnection myConn = new OleDbConnection(strDSN); OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM ce", myConn); DataSet ds = new DataSet(); myCommand.Fill(ds, "ce"); DataRow dr = ds.Tables["ce"].Rows[0]; STRING STR=dr["xi"].TOSTRING;其中xi时列字段名 有没有做过Socket通信服务的。 c#中正则表达式的递归算法如何写? 删除图片中出现的问题 webform的继承问题 哪位兄弟给份c# netmeeting二次开发的源码,感激不尽!!!!!!!!!!!!!! 55555只有最后的分了。。救命。。救命关于DATAGRID access 数据库,如何保护后台数据库,C#编程数据库的储存方案???(100分) sqlserver连接服务器失败 求一正则表达式, (没有分啦,不是不给分) 怎样禁用服务端的验证控件 菜鸟提问:关于返回结果(TextBox) 没遇到过的问题 怎么得到用鼠标选择的文本的内容 急!!!在线等
private int position_y;private void Form_Load(object sender,EventArgs e)
{DataSet ds=new DataSet();
...
dataGrid1.DataSource=ds.Tables[0];
DataGridCell c=new DataGridCell(0,0);
Rectangle rc=this.dataGrid1.GetCellBounds(c);
position_x=rc.Left;
position_y=rc.Top;
}
//下面的方法取得第一行某一列的值
private string GetValueAtFirstRow(int ColumnIndex)
{
DataGrid.HitTestInfo hti=dataGrid1.HitTest(position_x,position_y);
return dataGrid1[hti.Row,ColumnIndex].ToString());
}
当然,如果你重新设置了RowHeaderWidth或者会影响第一行在DataGrid位置的其他属性,你必须重新设置position_x和position_y
OleDbConnection myConn = new OleDbConnection(strDSN);
OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM ce", myConn);
DataSet ds = new DataSet();
myCommand.Fill(ds, "ce");
DataRow dr = ds.Tables["ce"].Rows[0];
STRING STR=dr["xi"].TOSTRING;
其中xi时列字段名