473,320 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Couple of questions about DetailsView and ObjectDataSource controls

Hi

I have a Business class called User which returns a DataRow for individual
user accounts using accountID as a parameter (i.e.
User.Retrieve(accountID)). The ObjectDataSource doesn't complain if I attach
the method to the SelectMethod property but the DetailsView does not display
it properly. The returned data in the DataRow is correct.

Do I need to put the DataRow back in a DataTable first or is there another
way? Also, if my class returns a user account through public properties can
I use the ObjectDataSource?

Can someone give me some pointers? I've already read most of the msdn stuff
but most of it seems to use the SqlDataSource as an example with the
DetailsView. So anything which deals with the DetailsView and
ObjectDataSource together would be useful.

Many thanks
Andrew
Apr 5 '06 #1
1 1301
Hi Andrew,

Thank you for posting.

As for the DataRow databinding problem, based on my understanding, it is
because ASP.NET databinding (bound a control's certain property to a
datafield of another dataobject) is based on class's "Property", not
field. And when we bind a DataSet or DataTable to a databound control(e.g a
DataGrid or GridView...), the databound control finally get a DataView
object, and the data object bound to each RowItem in the control is not
DataRow, instead it is a DataRowView. The difference between DataRow and
DataRowView is that DataRow does not expose Data fields (columns) through
public property or can not be reflected through PropertyDescriptor... While
the DataRowview class can let the databound control dynamically reflect its
data properties... (e.g through DataBinder.Eval(....)).

Though DataRowView can be used by databound control, I do not recommend
your data access class return this class's instance since it is mainly used
by ADO.NET built-in data components. For your scenario, I'd rather suggest
you create your own custom Account class which expose those data
fields(columns) through public properties, this can help them be correctly
reflected by databound control.

Hope this helps. If there's anything else unclear, please feel free to post
here.

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.)
Apr 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Jim Hammond | last post by:
I am passing the whole object instead or parameters in my select and update methods. I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate an update button, and then press...
7
by: studio60podcast | last post by:
I have a gridview and a details view in a page. The two are hooked up, so that when a row is selected in the GridView, the DetailsView displays the details. But, what I'm trying to accomplish is...
1
by: 47computers | last post by:
Hello. I'm having a bit of difficulty with some DropDownList controls within templates in a DetailsView on my web form. Basically, I have a form where a user is building a "location profile" with...
0
by: 47computers | last post by:
Hello. I'm having a bit of difficulty with some DropDownList controls within templates in a DetailsView on my web form. Basically, I have a form where a user is building a "location profile" with...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.