update databound DataGrid ?

inkedGFX

Well-known member
Joined
Feb 2, 2013
Messages
142
Programming Experience
Beginner
I have searched Google for an answer but have had NO luck finding an answer to this question.

I would like to update a DataGrid which is databound to a database....I have a page that creates a new Invoice..and the user can add items to the invoice ,,so when the user adds a item I create a list<Item> the Item has properties like name, description, price, quantity etc. etc. I add the item to the list everytime the user clicks the add item button....I would like to update the datagrid with each new item added...I could add the item to the database then update the page but if the user decides to cancel the invoice then I would have to delete the items added..I think it would be easier to keep it this way...but not sure if I can update the gridview because it is databound......?

-InkedGFX
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,136
Location
Sydney, Australia
Programming Experience
10+
Firstly, is it a DataGrid or a GridView? You say the former up until the last sentence, then you say the latter.

Regardless, I think what you need to do is make an AJAX call to update the data source and thus update the grid. I don't use Web Forms so I'm not well up on how AJAX is used but, from what I do know, I would expect that you'd have to put the grid inside an UpdatePanel.
 

inkedGFX

Well-known member
Joined
Feb 2, 2013
Messages
142
Programming Experience
Beginner
Ahhh...damn sorry about that , it is a GridView...I will try what you suggest with a UpdatePanel...Thank You!

-InkedGFX
 
Top Bottom