• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1770
  • Last Modified:

saving gridView selected reords in DataSet

my problem is now that how to save selected items(records) of gridView in dataset.and then again i have to put that dataset in session.and on cleck even i have to call dataset which is in session.lets i have one dataset named datasetOne .i am using this dataset for binding gridView .again user selects some reocords using check box in gridview and clicks on save button .then i need all selected records should be save in newly created dataset lets i have here datasetTwo.so all selected records should save in datasetTwo with its respective feilds(columns) value.and finally i will have to retrive session dataset's value on click button event.how to do it?
0
ajay1feb
Asked:
ajay1feb
  • 2
1 Solution
 
SammyCommented:
all you need is to cast the DataSource of the GridView to a DataSet then use it in anyway you want
GridView1.DataSource=YourDataSet
GridView.DataBind();

DataSet FilteredDataSet=((DataSet)GridView1.DataSource);
Session["FilteredData"]=FilteredDataSet;

Good luck
Sammy
0
 
ajay1febAuthor Commented:
just tell me how to store checked items data of gridview in in your FilterDataSet.
0
 
SammyCommented:
as I said in my previous post if you have a dataset as the datasource of the GridView control and need to move that to a different dataset then just do this
DataSet FilteredDataSet=((DataSet)GridView1.DataSource); //This is assuming your GridView is called GridView1
after this code is executed FilteredDataSet will hold whatever data is held in the GridView control
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now