thiru
thiru

Reputation:

how to insert row in grid view

i want to insert a new row to grid view while i click new button with out using the sqldatasource. and also how to edit, update, and delete rows from grid view. pls help me

[visual studio 2008 asp.net with c#]

thanks thiru

Upvotes: 0

Views: 7938

Answers (4)

Ivan Spahiyski
Ivan Spahiyski

Reputation: 86

If you want to do it without the SQL datasource, then set DataTable as a GridView's datasource.

Good example on how to populate and add a row to datatable.

Upvotes: 0

Migol
Migol

Reputation: 8448

For adding new row you could try putting controls in footer row of the GridView.

Editing, updating and deleting require you to do two things:

  1. implement those operations in the SqlDataSource
  2. enable these operations in GridView

Upvotes: 0

Cerebrus
Cerebrus

Reputation: 25775

What do you mean by "without using the SqlDataSource" ? How do you intend to propagate the inserted data to the data store, then ? You have not specified what other method you are using.

Anyway, the GridView does not inherently support insertion of records, but you can accomplish it by creating a FooterTemplate in which you create the fields for entry of new data. Additionally, provide a column to allow for Insert/Cancel buttons in the FooterTemplate.

Here's a good sample: How to easily insert row in GridView with SqlDataSource

Upvotes: 2

Canavar
Canavar

Reputation: 48088

Good gridview tutorial : ASP.NET Quickstart Tutorials

Upvotes: 0

Related Questions