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 / Windows Forms / WinForm General / January 2007

Tip: Looking for answers? Try searching our database.

Datagridview bound to a dataview

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
xanthviper@gmail.com - 23 Jan 2007 15:33 GMT
Pardon my ignorance here for I really can't find a direct answer to my
question concerning the DataGridView.

I have a Winform with a DataGridView on it. Its datasource is a
DataView. Life works great with the grid. I am able to sort, move
columns, and edit cells by clicking on the cell and making the change.

How do I update the changes to my DataView when I make a change to a
cell within the grid? I'm sure there is an easy answer to this and I
truly think i'm just having one of those days.  Hopefully someone may
be able to point me in the right direction.

I am using .NET 2.0 and C#.

I appreciate your time.

Regards,

-Charlie

My Code Setup:

DataTable criteriaData;

private void SiteChooserControl_Load(object sender, System.EventArgs e)
{

criteriaData = subject.SiteSelectionCriteriaDataTable;  //DataTable

gridSource = new DataView(criteriaData);
gridSource.AllowNew = false;
gridSource.AllowEdit = true;
gridSource.Sort = "SteNme";

AddHandlers();

this.grdSites.DataSource = gridSource;

}

protected void AddHandlers()
{
criteriaData.RowChanged += new
DataRowChangeEventHandler(criteriaData_RowChanged);
criteriaData.ColumnChanged += new
DataColumnChangeEventHandler(Criteria_ColumnChanged);
}
RobinS - 25 Jan 2007 21:44 GMT
The DataView is just a view of the original DataTable or DataSet.
It does not maintain its own copy of the data.

How you save the changes depends on the data source behind the
dataview.

Is criteriaData a datatable within a strongly typed dataset?
Does the strongly typed dataset have an update command object?

Generally speaking, one can invoke the Update method on the
table adapter used to fill the dataset in order to save the
changes in the detached dataset back to the database.

Hope this helps.
Robin S.
-----------------------------------------------
> Pardon my ignorance here for I really can't find a direct answer to my
> question concerning the DataGridView.
[quoted text clipped - 44 lines]
> DataColumnChangeEventHandler(Criteria_ColumnChanged);
> }

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.