Databinding to DetailsView

M

Matt MacDonald

Hi All,
This is hopefully a stupid question.

I have a page with a details view that is bound to an object datasource.
The datasource pulls back a strong-typed datatable from my users database.
The way my app works, a user will not automatically have a username and
password until one is assigned. That being said, when the detailsview binds
to the data, those two fields will be null. Logic would tell me that
wouldn't be a problem, because in other databound controls (gridview for
instance), it just replaces null values with empty strings. For whatever
reason, when I do a details view, I get something to the effect of
"Conversion from type 'DBNull' to type 'String' is not valid." for the
username field when I try to load the page. Any thoughts on how to get past
this would be greatly appreciated.

Thanks,
Matt
 
M

Matt MacDonald

As an update, I realized that my datasource actually returns a single row,
not a table. Changing this to a table seems to fix the problem, but still
doesn't make much sense.

Thanks,
Matt
 
C

Cor Ligthert [MVP]

Matt,

It is a valid AdoNet question, however I give you on this one more chance in
the newsgroup.


Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top