Re: Updating data using DataView by W
W
Thu Sep 30 17:41:26 CDT 2004
If you're losing it it's probably because of the post back. If you were to
store it in Session state for instance, you could deserialize it after the
post back and it would still retain its state.
"Nikhil Patel" <donotspam@nospaml.com> wrote in message
news:#48Lj#ypEHA.3688@TK2MSFTNGP09.phx.gbl...
> Hi,
> Thank you all for your replies. If the rows in the DataTable get changed
> automatically then I guess I have a different problem. I lose the
reference
> to the underlying DataTable and the DataSet in the aspx form.
>
> Here is the code. Page_Load works fine and I am able to see the rows in
grid
> and edit them. But I don't know how to save the data back to the DataSet
> when the user clicks on a Button.
>
> private void Page_Load(object sender, System.EventArgs e)
> {
> if (!Page.IsPostBack)
> {
> string sFieldName = Request.QueryString["FieldName"];
> DataSet dataSetLookup = (DataSet) Application["Lookup"];
>
> DataView viewLookup =
> dataSetLookup.Tables["ProposalLookup"].DefaultView;
> viewLookup.RowFilter = "FieldName = '"+sFieldName+"'";
> viewLookup.Sort = "FieldValue";
>
> gridLookup.DataSource = viewLookup;
> gridLookup.DataBind();
> }
> }
>
>
> "Cowboy (Gregory A. Beamer) - MVP" <NoSpamMgbworld@comcast.netNoSpamM>
wrote
> in message news:615C4899-5BEE-4531-8F10-402D90A7CF97@microsoft.com...
> > If you bind a DataView, you are actually binding to the underlying rows
in
> > the DataTable. When you change a row, the row is changed, regardless of
> > how
> > it is bound.
> >
> >
> > ---
> >
> > Gregory A. Beamer
> > MVP; MCP: +I, SE, SD, DBA
> >
> > ***************************
> > Think Outside the Box!
> > ***************************
> >
> > "Nikhil Patel" wrote:
> >
> >> Hi all,
> >> I am using DataSet to store Sql Server Data in my ASP.Net
application
> >> and
> >> use it in several .aspx forms by saving it in Cache. In one of the
forms,
> >> I
> >> need to filter one of the tables in DataSet and display the result in
an
> >> Editable grid. I do this by creating a DataView by filtering the table
in
> >> the DataSet. The problem is saving the data from DataView back to the
> >> table
> >> in DataSet. Do I need to loop through each row and see what changes
have
> >> been made or there is an easier way?
> >> Thanks.
> >>
> >>
> >>
>
>