我在MSDN中没有找到网上说的datagrid1.CurrentCell,怎样获得列名呢?请大家帮忙啊
解决方案 »
- 数据恢复软件
- C#开发的winform控件在asp.net中引用的问题!!
- c#对数据库进行添加删除更新的代码
- 多天没有解决的问题,没时间在自己研究了,各位哥哥帮帮忙吧,进进进。。。。
- 用WebClent.DownloadFile超时,如果解决
- 一个关于命名空间的问题!?
- 求GIS算法库(提供下载地址)
- 轻轻地我来了,就不会轻易地走,从此与大家同甘共苦 C# !
- filestream保存图片浏览问题
- 在VC#中订阅消息要手工输入,为什么不做成VB一样?有简单方法吗?
- vs2005工具箱里面没有OleDbConnection控件,我是照着书学习的.书上有,而我的里面没有,在网上找了说是得自己添加,不过不知道怎么添加?
- c#关于字符串的处理
{
SqlConnection Conn = new SqlConnection();
Conn.ConnectionString = "server=(local);Database=pi;uid=sa;pwd=200082442311";
Conn.Open();
DataSet ds = new DataSet();
SqlDataAdapter DP = new SqlDataAdapter("select top 10 * from project", Conn);
DP.Fill(ds, "table");
DP.Dispose();
Conn.Close();
Conn.Dispose();
ds.Tables[0].DefaultView.AllowDelete = true;
dataGridView1.AutoGenerateColumns = false;
DataGridViewTextBoxColumn colName = new DataGridViewTextBoxColumn();
colName.Name = "PKID";
colName.HeaderText = "PKID";
colName.DataPropertyName = "PKID";
this.dataGridView1.Columns.Add(colName); DataGridViewTextBoxColumn colName1 = new DataGridViewTextBoxColumn();
colName1.Name = "SALES";
colName1.HeaderText = "SALES";
colName1.DataPropertyName = "SALES";
this.dataGridView1.Columns.Add(colName1); dataGridView1.DataSource = ds.Tables[0];//.DefaultView;//设置DataGrid的数据源
} private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
MessageBox.Show(e.KeyCode.ToString());
if (e.KeyCode == Keys.Enter)
{
MessageBox.Show(((DataGridView)sender).CurrentCell.OwningColumn.Name);
}
}
GridView1.Rows[i].Cells[i]...
dataGridView1.Columns[i].Name
gridview1.selectedIndexchanged(,)
{
string name;
name = gridview1.Rows[1].Cells[1].Name;
}报错说没有Name属性阿,而且怎莫gridview不能选择呢? 我是新手,让大家见笑了,请高手们指点。
{
CheckBox pro = (CheckBox)GridViewPro.Rows[i].FindControl("CheckPro");
Label laname = (Label)GridViewPro.Rows[i].FindControl("LabProductname");
if (pro.Checked)
{ ProMeDetailsBO pmbo = new ProMeDetailsBO();
string productname = laname.Text.ToString();
SqlParameter[] paramlist = new SqlParameter[1];
SqlParameter name = new SqlParameter("@productname", SqlDbType.NVarChar);
name.Value = productname;
paramlist[0] = name;
ProMeDetail pmd = new ProMeDetail();
pmd.DeleteBatch("DelectProductByProductname", paramlist);
Label labnote = (Label)GridViewPro.Rows[i].FindControl("Labnote");
labnote.Text = "D"; }
你试一下,dataGridView1_CellLeave事件