Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / DataGrid / January 2008

Tip: Looking for answers? Try searching our database.

A GridView with an unbound datasource - editing the values.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mufasa - 10 Jan 2008 13:41 GMT
I want to have a gridview where the user can enter/edit/delete records and
when they are finally done, I will write out the records to the database
myself. So I don't want the records updated until they push the save button.

Does anybody have any samples of code that does this?

TIA - Jeff.
Eliyahu Goldin - 14 Jan 2008 10:09 GMT
Let your gridview do things that it knows how to do well. Update one record
in the time in a regular way, but do it against a temporary datasource as
opposed to the real database table. Then, on the save click, dump all
updated records from the datasource to the database.

Signature

Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net

>I want to have a gridview where the user can enter/edit/delete records and
>when they are finally done, I will write out the records to the database
[quoted text clipped - 4 lines]
>
> TIA - Jeff.
Mufasa - 14 Jan 2008 20:14 GMT
When you say 'do it against a temporary datasource' how would I go about
doing that? Ideally it would just be in memory - no need to assign it
anywhere until I'm done with it.

The only things I've seen where you do update/inserts you assign the
datasource to a source in the aspx page.

TIA - Jeff.

> Let your gridview do things that it knows how to do well. Update one
> record in the time in a regular way, but do it against a temporary
[quoted text clipped - 9 lines]
>>
>> TIA - Jeff.
Eliyahu Goldin - 15 Jan 2008 13:35 GMT
Don't use declarative databinding with DataSourceID property. Use the
DataSource property and call DataBind method explicitly.  The datasource can
be an instance of the DataTable class, or an ArrayList or any other
collection object.

You can make a strictly-typed dataset in design time, the designer will
created also a TableAdapter for updating data. In run-time, get it populated
from the database, databind to the grid and your updates will run against
the DataTable in the dataset. The dataset is a memory object, nothing will
go to the database until you call myTableAdapter.Update()..

Signature

Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net

> When you say 'do it against a temporary datasource' how would I go about
> doing that? Ideally it would just be in memory - no need to assign it
[quoted text clipped - 18 lines]
>>>
>>> TIA - Jeff.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.