Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

Can anyone know?

Can we insert data directly in gridview and it should store in Database?
Posted

1 solution

You can bind the GridViewto just about any kind of collection. The data does not need to come from a database. The datasource can be an array, a List, or a custom object. This link has an example of binding the GridView to a custom object list.

Essentially you tell the grid view what the datasource is and call its databind method.

Binding List of Custom Class to GridView or ListView Control
 
Share this answer
 
Comments
sathiyak 27-Feb-12 0:36am    
in interview HR asked me just IN gridview whether we can insert data directly or not?thats my question..
Israel Cris Valenzuela 27-Feb-12 1:19am    
I see. It sounds like they want to know your solution for displaying custom data in a gridview. It is possible but only by creating a custom collection like a List<customer> and then binding that collection to the grid view. The data for the collection can come from anything (database, text file, hard coded, etc.).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900