Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello sir,
Am working in VS using winform C#,thing is i had created three textbox,and two buttons.A button called "insert" and Below to that datagridview will be visible.
What i want is if i enter some data into textboxes and if i tap the "insert " button.Then its particular rows get to inserted acoording to there columns.And as soon as i tap the "insert" button,only its row as to be displayed in datagridview.

And if i enter the new data into the same textboxes ,then same as usual.It as to update in database and dispayed as second row in datagridview.


I got stuck ,how to achieve this sir.

Thanks
PRADEEPCBZ
Posted

1 solution

Instead of inserting it into GridView you need to insert in into container. The container should implement INotifyCollectionChanged. GridView should update automatically once new row added to collection.
For example of how it should be done search for ObservableCollection[^] and binding to ObservableCollection[^]
 
Share this answer
 
Comments
Pradeep CBZ 5-Apr-12 7:42am    
Hello sir,
As i said earlier,its manadatory to do here and get data into "gridview" sir.Am doing project in ASP.net ,thing is aftering entering into textboxes and if i click into the "insert " button.Then it has to first save into the database(MSSQL) and has to be dislayed in the "gridview",as a single row.

Now if i enter a new data into the same textboxes,then its row as to be visible in the "gridview" as a second row....

So finally two rows has to be visible to us.

pLease tel me ,how to achive this...or if you hav the idea,please do share here sir..

If code is shown,then it will be helpfull.

Thanks
PRADEEPCBZ

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900