Editable GridView loaded from a dataset
Posted on 2008-02-05
I am trying to make an editable gridview control which does not save to the database. Instead of saving to the database, I want it to load from a dataset - the dataset will save and update to XML which is stored into a cookie. For this question, that is really irrilevant, I just wanted to let you know what I am doing. Instead of saving to XML, I will just save it to session so I can understand more.
Can anyone post an example (html & C#) of an editable gridview that will save the updates to a dataset instead of the database? I can not find any examples of this online - everyone has them bound to a SqlDataSource or ObjectDataSource control, I don't want ot use those.
By an editable gridview, I simply mean one which has an 'edit' button that, when clicked, makes that row editable (say, a textbox for example). Then, when the user clicks 'save' or 'cancel' (while the row is being edited) it stops editing and simply shows the label so the user can't edit the row. Instead of saving to the database, I would like it saved to a dataset which is in session (like Session["Myrecords"] = myDataSet;
I only need a simple example of the gridview - like a gridview with two columns: a label (when not being edited) and a button that says 'Edit'. Then, when being edited, the label becomes a textbox and the 'Edit' button becomes 'Save' and 'Cancel'. When the 'Save' button is clicked, the values are stored into a dataset (or datatable).
Thank you for all of your help!