Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
200
how to get dataset from a grid which has already bound to a dataset
posted

 I have a datagrid wich is already bound to a dataset, I need toget this dataset,make changes on some data, then rebind the datagrid with the modified dataset. Like this:

datagrid1.datasource=ds1;

..........

//how to get the dataset from the datagrid???

ds2=datagrid1.datasource;

make changes on ds2;

datagrid1.datasource=ds2;

Parents
No Data
Reply
  • 1775
    posted

    1.

    rajathan said:
    //how to get the dataset from the datagrid???
     

      DataSet ds2 = (DataSet)datagrid1.datasource;

     

    2.

    rajathan said:
    rebind the datagrid with the modified dataset.
     

    In general you don't need to rebind the dataset (or need something else to update the grid). The grid should react to changes in the data source. This is the main concept of data binding. There are though some ... small features in dataset events which should be taken into account. If your grid does not update itself after your operations with the dataset - post a message here. There are workarounds to make datagrid update itself (explicit calls).

Children