可以的,只把某一行的某一个段设定为可输入即可。
推荐实用代码网站。http://bingning.net/free/source/datagrid/index.html
推荐实用代码网站。http://bingning.net/free/source/datagrid/index.html
解决方案 »
- 不同窗体之间 两个控件传值
- 转成int的小问题
- 间隔若干秒显示图片
- 关于VSS的问题
- MemoryStream.Position 和 MemoryStream.Seek 有什么区别吗?
- 小弟,刚接触C#有些问题 谁来帮我解决一下 先谢谢了
- 求救!!2003和2005的数据库中取出的字符串不相同!!
- (挑战高手!)C#里面调用Windows的API(VC6写的,标准C调用),如何声明函数指针?
- 『新手求助』C#界面问题:在主FORM中要最大化打开3个FORM都是。多谢
- 给位大神给我的思路吧
- 要做一个类似VISIO操作的软件 需要用到哪些知识呢?
- WebClient DownloadFileAsync 不触发DownloadProgressChanged事件?
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace WindowsApplication239
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent(); DataGridView DGV = new DataGridView();
DGV.Parent = this;
DGV.Columns.Add("c1", "c1");
DGV.Columns.Add("c2", "c2");
DGV.Rows.Add(new Object[] { 1,11 });
DGV.Rows.Add(new Object[] { 2,22 });
DGV.Rows.Add(new Object[] { 3 ,33});
DGV.CellBeginEdit += new DataGridViewCellCancelEventHandler(DGV_CellBeginEdit);
} void DGV_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
{
e.Cancel = !(e.RowIndex == 1 && e.ColumnIndex == 0);
}
}
}
好像是,不敢肯定
在GridView的RowEditing事件中去写: protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
//设置GridView的编辑行为当前行
GridView1.EditIndex = e.NewEditIndex;
//下面重新绑定数据
}
http://www.cnblogs.com/sufei/archive/2009/03/14/1485995.html
<%# Eval("name") %>
</ItemTemplate> <EditItemTemplate > <asp:TextBox id="txt_name" CssClass="inputText" MaxLength="100" runat="server" Text='<%# Eval("name") %>' Width="86%"> </asp:TextBox>
</EditItemTemplate>
protected void gv_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
gv.EditIndex = e.RowIndex;
string str=((TextBox)gv_PrcsProp.Rows[e.RowIndex].FindControl("txt_name")).Text.Trim());
gv.EditIndex = -1;
BindData();
}
把要取消编辑的列转换为TemplateField,然后转到HTML源代码中,找到那一列,把EditTemplate里面的TextBox改成Label,就这么简单!
推荐你研究一下:GridView 72般绝技http://blog.csdn.net/21aspnet/archive/2007/03/25/1540301.aspx