Click here to Skip to main content
13,088,101 members (69,158 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi All,

I have some problem. I have three textbox with three field, one button and one gridview control. I wants whenever i click on "ADD" button whichever insert row and display data in gridview without database. But when i click on "ADD" button then add one row record in gridview and after that click again "ADD" button then replaceed data in this row not insert the second row in gridview control. So please help and suggest me.

In Advance, Many Many Thanks,
Posted 12-May-13 3:57am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You don't need a database to have a DataTable and bind a GridView to it. You just need the DataTable object, to which you can add rows all you want. But, first, you have to define the DataTable. You need to add the columns to it, tell it what type of data they are going to hold, if there's a primary key, ... blah, blah, blah, ...

Once you have that built, you can call the NewRow method on the DataTable object to get a DataRow that's using the schema of the table, populate the fields in it with the data that the user entered, then add the row to the DataRow.Rows collection.
Maciej Los 12-May-13 15:19pm

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 12 May 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100