Edit datagrid row

I want to know how to edit a single row (which I select) from a data grid

for example, I have a datagrid with columns A, B and C and I have a couple of rows of data, about 10 rows.

will say that I want to change the value of the data in line 4.

How can i do this?

I am using visual studio 2003, but I think if Visual Studio 2005 would be fine too. for coding i use c #

thank..

+3
source share
3 answers

All grid-like components of asp.net have the same machinism as for editing a single line. Actually by default for asp.net only for editing one line in the grid.

asp: button asp: linkbutton ItemTemplate CommandName, "Edit". , , . DataGrid EditCommand. EditItemIndex Item.Itemindex eventargs. , EditItemTemplate.

2 . , CommandName "", CommandName "".

"" UpdateCommand. , (: database) EditItemIndex -1 → (ItemTemplate AlternateItemTemplate).

"" CancelCommand. si EditItemIndex -1.

DataGrid en, asp.net, GridView, "Boilerplate", . Google . .

, ?

+1

EditItemTemplate datagrid. ItemTemplate , , EditItemTemplate , .

, :

http://www.gridviewguy.com/

+1

Is your data in a DataTable before you make it a DataGrid, or can you put it in a DataTable? You can update / delete / edit rows in a DataTable, here the link to the code snippets is pretty simple:

http://msdn.microsoft.com/en-us/library/tat996zc(VS.80).aspx

0
source

Source: https://habr.com/ru/post/1698459/


All Articles