HighTechTalks DotNet Forums  

Databinding to DetailsView

Dotnet Framework (ADO.net) microsoft.public.dotnet.framework.adonet


Discuss Databinding to DetailsView in the Dotnet Framework (ADO.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Matt MacDonald
 
Posts: n/a

Default Databinding to DetailsView - 01-02-2008 , 11:24 AM






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



Reply With Quote
  #2  
Old   
Matt MacDonald
 
Posts: n/a

Default Re: Databinding to DetailsView - 01-02-2008 , 11:29 AM






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

"Matt MacDonald" <mattsmac (AT) hotmail (DOT) com> wrote

Quote:
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




Reply With Quote
  #3  
Old   
Cor Ligthert [MVP]
 
Posts: n/a

Default Re: Databinding to DetailsView - 01-03-2008 , 05:39 AM



Matt,

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

news:\\microsoft.public.dotnet.framework.aspnet

Cor

"Matt MacDonald" <mattsmac (AT) hotmail (DOT) com> schreef in bericht
news:epk4IRWTIHA.5016 (AT) TK2MSFTNGP06 (DOT) phx.gbl...
Quote:
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




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.