Here's the deal. I have a gridview that I need to fill by adding one record at a time. Is there a procedure for inserting a record in a gridview?
Adding rows to a gridview
Collapse
X
-
The values of several of the columns are dependent on other columns in the rows so I wanted to evailuate the data defore displaying it in the grid. From what I've read, it's not possible to insert rows into a dataview one by one programically. I'm not sure I understand your solution.Comment
-
See you never mentioned the use of a DataView so I wasn't exactly sure what you were doing.
To do this you need to dynamically create a DataTable.
Then create a new DataView based on this DataTable:
Code:Dim dynamicTable As DataTable = createDataTable() Dim myDataView As New DataView(dynamicTable) myGridView.DataSource = myDataView;
Comment
-
It is EXTREMELY pain in everywhere to insert a record using Gridview. Here is a good article yet painful.
steps: 1) Create the simple web application (asp.net with C#). 2) Create new table (User) in your database. Column Name Data Type UserId int (Pk and AutoIncrement) UserName varchar(50) Address1 var…
http://www.c-sharpcorner.com/uploadf...e&user=qarjami
I have 10 more links on this. let me know if these dont help. Good LuckComment
-
Comment
-
Yup.
It's not pretty and I'm sure that there is a more elegant way to do it (using a different Object as the datasource).
But it's not as bad as it sounds. Especially if you are grabbing data from a database because you'll likely already have a table at that point.
In my case I'm converting Objects into a table, so it's a bit messier than your solution will be. Well it's only messy for the table generation part really, after that it's not so bad. It's been a long time since I've used a database (hope that will change in the near future).Comment
Comment