Home All Groups Group Topic Archive Search About
Author
11 Apr 2006 8:25 PM
David Thielen
Hi;

I have a page that displays a record and uses an ObjectDataSource to select
the data to be displayed.

How can I get the data it read? I know I can call select() on the object.
But that reads it again and if another user has updated it since the first
read, then I am using data different from what my page is displaying.

So how can I get the data it read to populate the page?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Author
11 Apr 2006 8:29 PM
David Thielen
Hi again;

And how can I tell if the select did get a row - as opposed to no PK passed
in or a PK for a record that no longer exists.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com



Show quoteHide quote
"David Thielen" wrote:

> Hi;
>
> I have a page that displays a record and uses an ObjectDataSource to select
> the data to be displayed.
>
> How can I get the data it read? I know I can call select() on the object.
> But that reads it again and if another user has updated it since the first
> read, then I am using data different from what my page is displaying.
>
> So how can I get the data it read to populate the page?
>
> --
> thanks - dave
> david_at_windward_dot_net
> http://www.windwardreports.com
>
Author
11 Apr 2006 10:39 PM
Phillip Williams
You can inspect the InputParameters while handling the selected event of the
ObjectDataSource: http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.selecting(VS.80).aspx

You can tell the no. of records that came out during by handling the
Selected event and retrieving the ReturnValue of the ObjectDataSource (which
would be a third option in answering your previous question on how to get the
data that was selected) , e.g.

    void odsCustomersList_Selected(object sender,
ObjectDataSourceStatusEventArgs e)
    {
        lblCount1.Text = "Total Record count= " +
((DataView)e.ReturnValue).Count.ToString();
    }
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.selected(VS.80).aspx
Show quoteHide quote
"David Thielen" wrote:

> Hi again;
>
> And how can I tell if the select did get a row - as opposed to no PK passed
> in or a PK for a record that no longer exists.
>
> --
> thanks - dave
> david_at_windward_dot_net
> http://www.windwardreports.com
>
>
>
> "David Thielen" wrote:
>
> > Hi;
> >
> > I have a page that displays a record and uses an ObjectDataSource to select
> > the data to be displayed.
> >
> > How can I get the data it read? I know I can call select() on the object.
> > But that reads it again and if another user has updated it since the first
> > read, then I am using data different from what my page is displaying.
> >
> > So how can I get the data it read to populate the page?
> >
> > --
> > thanks - dave
> > david_at_windward_dot_net
> > http://www.windwardreports.com
> >
Author
12 Apr 2006 6:22 AM
Steven Cheng[MSFT]
Thanks for Phillip's input.

Hi Dave,

In addition to the Selected event Phillipi mentioned, you can also have a
look on the ObjectCreated event:

#ObjectDataSource.ObjectCreated Event  
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdat
asource.objectcreated(VS.80).aspx

this event fires after the ObjectDatasource control created the underlying
data access object, so if you have some customized methods or  properties
on it, you can configure it at that time. Also, this is also a good place
to hold a reference to the underlying data access class object for
sequential use in the page's request.

Hope this also helps.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
11 Apr 2006 10:33 PM
Phillip Williams
You get the data, that the select method had read:

1-    While handling the DataBound event of the control bound to the
ObjectDatasource by accessing the DataItem property
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.formview.dataitem(VS.80).aspx http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridviewrow.dataitem(VS.80).aspx

2-    From the Select method if you had set the EnableCaching to true within a
period of seconds that you had specified in the CacheDuration property
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.select(VS.80).aspx

http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasourceselectingeventargs(VS.80).aspx

Show quoteHide quote
"David Thielen" wrote:

> Hi;
>
> I have a page that displays a record and uses an ObjectDataSource to select
> the data to be displayed.
>
> How can I get the data it read? I know I can call select() on the object.
> But that reads it again and if another user has updated it since the first
> read, then I am using data different from what my page is displaying.
>
> So how can I get the data it read to populate the page?
>
> --
> thanks - dave
> david_at_windward_dot_net
> http://www.windwardreports.com
>