查找单击的单元格的索引 [英] Find index of the cell clicked

查看:77
本文介绍了查找单击的单元格的索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是使用C#入门ASP.Net的人,当在运行时双击该单元格时,谁能指导我向gridview的单元格添加一个下拉列表,则在双击该单元格之前,该单元格不可编辑

I''m beginner to ASP.Net with C# Can anyone guide me to add a dropdown to the cell of gridview when the cell is double clicked at runtime, the cell should not be edittable until it is double clicked

推荐答案

具有单元格单击事件的扩展ASP.NET GridView [ ^ ]


首先在Formdesigner中为DataGridView添加一个CellClick事件,如下所示:
First add a CellClick event in Formdesigner for the DataGridView as below:
this.dataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellClick); 


然后在表单中添加以下代码以获取单元格地址:


Then add following code in your form to get cell address:

<pre lang="cs">private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
       {
            Point p = dataGridView1.CurrentCellAddress;
           MessageBox.Show(p.X.ToString(), p.Y.ToString());    // display row and cell nos.
   }





希望对您有帮助.





Hope this will help you.


这篇关于查找单击的单元格的索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆