我怎样才能在gridview中使只有一列可编辑. [英] how can i make in gridview only one column as editable.

查看:596
本文介绍了我怎样才能在gridview中使只有一列可编辑.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张数据表,用一列可编辑的数据填充到grideview中,需要更新数据库.

i had a table of data to fill the grideview with editable of one column which needs to be update the database.

推荐答案

出了什么问题?您要做的就是相应地设计ItemTemplate/EditTemplate.

您必须使用"AutoGenerateColumns"属性为true.它将您的控件限制在网格中可见的内容以及行为方式.将其设置为false,然后定义您的列.将列字段转换为模板字段,然后设计网格以根据需要显示.

TemplateField对象使您可以指定包含标记和控件的模板,以自定义GridView控件中列的布局和行为.使用ItemTemplate,可以指定GridView在列中显示数据时要使用的布局.

在这里阅读所有内容:
MSDN:在GridView控件中使用TemplateFields [ MSDN:在GridView Web服务器控件中创建自定义列 [ MSDN:TemplateField.ItemTemplate属性 [ ^ ]
Whats the issue? All you have to do is design your ItemTemplate/EditTemplate accordingly.

You must be using ''AutoGenerateColumns'' property as true. It will limit your control to what will be visible in grid and how it will behave. Set it to false and then define your columns. Convert column fields into template field and then design your grid to display as per your need.

A TemplateField object enables you to specify templates that contain markup and controls to customize the layout and behavior of a column in a GridView control. Using an ItemTemplate, you can specify the layout to be used when the GridView displays data in a column.

Read all about it here:
MSDN: Using TemplateFields in the GridView Control[^]
MSDN: Creating a Custom Column in a GridView Web Server Control[^]
MSDN: TemplateField.ItemTemplate Property[^]


请参阅以下内容可能对您有帮助:

在ASP.NET中编辑单个GridView单元格 [ ^ ]

http://go4answers.webhost4life.com/Example/gridview-textcolumn-editable-dinamic- 111794.aspx [ ^ ]
Refer these may help you:

Edit Individual GridView Cells in ASP.NET[^]

http://go4answers.webhost4life.com/Example/gridview-textcolumn-editable-dinamic-111794.aspx[^]


这篇关于我怎样才能在gridview中使只有一列可编辑.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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