PC Review


Reply
Thread Tools Rate Thread

Databinding to DetailsView

 
 
Matt MacDonald
Guest
Posts: n/a
 
      2nd Jan 2008
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
 
 
 
 
Matt MacDonald
Guest
Posts: n/a
 
      2nd Jan 2008
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      3rd Jan 2008
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" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> 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
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
.NET-Noob and Databinding (DataSet, DetailsView) Martin Frey Microsoft ASP .NET 3 4th Oct 2007 01:53 AM
.NET-Noob and Databinding (DataSet, DetailsView) Martin Frey Microsoft ADO .NET 0 3rd Oct 2007 09:02 AM
Databinding expressions are only supported on objects that have a DataBinding event jobs Microsoft ASP .NET 0 26th Sep 2007 12:54 AM
Update of DetailsView with programatic DataBinding kamlesh Microsoft ASP .NET 0 13th Jun 2007 06:07 PM
DetailsView - Won't switch to Edit mode if databinding programmatically Mark Stafford Microsoft ASP .NET 1 29th Aug 2006 01:02 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:06 PM.