Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
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 4:57am
Rate this: bad
good
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.
  Permalink  
Comments
Maciej Los at 12-May-13 15:19pm
   
+5
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  

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

  Print Answers RSS
0 OriginalGriff 8,284
1 Sergey Alexandrovich Kryukov 7,327
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,920


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 12 May 2013
Copyright © CodeProject, 1999-2014
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