Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 23rd, 2004, 08:52 PM
Registered User
 
Join Date: Nov 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataGrid: Create a new Row

Hi There:

It's a newbie question - I am trying to see if we can use the Datagrid for [u]adding a row</u>, which updates the backend store after the user enters data in that? Does anyone have any ideas on this?

Thx,
Ash
 
Old November 24th, 2004, 01:23 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

you can use DataSet objects as datasource of your grid,
1-take input data from user,
2-then change your dataset(Adding,Deletting,Updating rows),
3-and finally update your datasource,
I think thisthread could help you more.

_____________________________
Mehdi.
software engineering student.
Looking for a good job for summer 2005.
 
Old November 30th, 2004, 10:29 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

The important thing to know about your question is that you can't add a row to a datagrid, you must add a row to the datasource for the grid then re-bind the grid.

Usually, the datasource for the grid is some class that has a item count property. From that you can determine the last item index, then add 1, set the EditItemIndex of the grid to that value and re-bind the grid. Now you have a "new row" in the grid that is set up for data entry. Then you just need to modify your logic a bit to do a data insert instead of an update. When you save the row.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Scrollbar in row of Datagrid Except Header Row Theone84 ASP.NET 2.0 Professional 0 August 11th, 2008 12:10 AM
Create new row using a typed dataset humour ASP.NET 2.0 Professional 0 May 9th, 2008 09:49 PM
Datagrid - format a row jgferguson Beginning VB 6 0 May 25th, 2007 03:48 AM
Manage data row by row in datagrid Dragonist Classic ASP Databases 5 July 29th, 2004 04:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.