473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

adding empty row to databound datagrid

Jim
In my Win App, I have a datagrid that's bound to a dataset. When the form
loads, the datagrid fills. How can I add an empty row to the end of the
datagrid during a button click (similar to pressing Tab when mouse pointer
is on last field of last record of datagrid)? The datagrid's read-only so
the user won't be able to modify it unless he wants to add a new record via
the datagrid (by adding the empty row).
Also, if I modify the datagrid, how can I update the physical data? I only
have the dataset to

Thanks.

Nov 15 '05 #1
2 9982
You can add a new DataRow to the DataTable, you can use a bindingContext or
BindingManagerBase and use the .AddNew() method. Is the grid supposed to be
read-only for everything but new Rows? I'm not sure if I'm understanding
correctly.

As far as updating goes, do you mean the Data in the DataBase? Since it's a
WinApp, I'm assuming your grid is bound to a DataTable. Any changes made
through the grid will be reflected in the DataTable. So you can simply call
DataAdapter.Update(yourTable) and provided you have update Logic , that's
all you should need. If you havne't used a DataAdapter Configuration
Wizard, you'll need to either use a CommandBuilder or roll out your own
stuff.
Either way, it's pretty straightforward. I'm not sure I understand the
problem, but if you can give me a little more detail, I can probably get you
through it.

Cheers,

Bill
"Jim" <NA> wrote in message news:ee****************@TK2MSFTNGP09.phx.gbl...
In my Win App, I have a datagrid that's bound to a dataset. When the form
loads, the datagrid fills. How can I add an empty row to the end of the
datagrid during a button click (similar to pressing Tab when mouse pointer
is on last field of last record of datagrid)? The datagrid's read-only so
the user won't be able to modify it unless he wants to add a new record via the datagrid (by adding the empty row).
Also, if I modify the datagrid, how can I update the physical data? I only
have the dataset to

Thanks.

Nov 15 '05 #2
Jim
Thanks for your reply. Sorry for the incomplete post.
The datagrid is read-only because I use it to display data. But if the user
wants to add another record to the grid, he'll click the Add button and a
new empty row will appear in the DG for him/her to add the new record
As for updating, I only have the dataset because that's what the method
returns. I'd like to be able to go through the whole datagrid to see what
has been added.
Thanks.

"William Ryan" <do********@comcast.nospam.net> wrote in message
news:eQ**************@TK2MSFTNGP11.phx.gbl...
You can add a new DataRow to the DataTable, you can use a bindingContext or BindingManagerBase and use the .AddNew() method. Is the grid supposed to be read-only for everything but new Rows? I'm not sure if I'm understanding
correctly.

As far as updating goes, do you mean the Data in the DataBase? Since it's a WinApp, I'm assuming your grid is bound to a DataTable. Any changes made
through the grid will be reflected in the DataTable. So you can simply call DataAdapter.Update(yourTable) and provided you have update Logic , that's
all you should need. If you havne't used a DataAdapter Configuration
Wizard, you'll need to either use a CommandBuilder or roll out your own
stuff.
Either way, it's pretty straightforward. I'm not sure I understand the
problem, but if you can give me a little more detail, I can probably get you through it.

Cheers,

Bill
"Jim" <NA> wrote in message

news:ee****************@TK2MSFTNGP09.phx.gbl...
In my Win App, I have a datagrid that's bound to a dataset. When the form loads, the datagrid fills. How can I add an empty row to the end of the
datagrid during a button click (similar to pressing Tab when mouse pointer is on last field of last record of datagrid)? The datagrid's read-only so the user won't be able to modify it unless he wants to add a new record

via
the datagrid (by adding the empty row).
Also, if I modify the datagrid, how can I update the physical data? I only have the dataset to

Thanks.


Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tonya | last post by:
Hi All, I wanted to ask how i can add values from textboxes etc into a specific coloumn and row of a datagrid. I.e does the datagrid have coordinates that i can refernce when i want to add...
1
by: Patrick Demets | last post by:
I have a fairly simple form with databound text boxes, but changes (or new records) are not recognized. The text boxes are successfully populated with data (from the database) and I can cycle...
4
by: Harold | last post by:
I have read the following article http://www.4guysfromrolla.com/webtech/073101-1.shtml. I added the empty selection as the first option. When I click submit without choosing anything it does not...
1
by: GaryDean | last post by:
It seems every time I try to use the GridView to do what I used to do with the DataGrid I run into differences that make me want to got back to the datagrid. for instance... the DataGrid...
1
by: lgalumbres | last post by:
Hi, I have a datagrid on Winform that is bound to a datatable. In essence, what I would like to do is that when a user inputs a number into a textbox control for example 5 then 5 empty rows...
1
by: RSH | last post by:
Hi, I have a datagrid that is bound to a datasource. I now need to add a checkbox column to the datagrid in column(0) position which is independent of the datasource. I will be checking for...
6
by: =?Utf-8?B?QmVuLg==?= | last post by:
Hi, I'm more of a windows programmer than ASP and I've having a little difficulty in ASP.Net (framework 2.0) - VB.net I have a datagrid on an aspx page and the html is building the display in...
3
by: dbuchanan | last post by:
How, at rundime, do I capture the fact that the parametrized query that fills a CheckBoxList results in an empty set. When the dataset is empty the CheckBoxList does not appear. I would like to...
2
by: ree321 | last post by:
I tried moving an ASP.net project form 1.1 to 2.0. But I am having problems with getting the OnItemDataBound function to run for a datagrid, in 2.0. It only gets called up if AutoGenerateColumns...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.