concantenating fields in a drop down

concantenating fields in a drop down

Postby mainship » Tue 31 Mar 2009 17:24

I have a dropdown list that's populated by a database. It displays all the dates that are valid for a user's selection. It currently displays a dateTime field called dDate. I have another field called DOW that contains the day of week associated with the date in dDate. I want the drop down to display DOW-dDate.

In my markup I have




and




I'm using Linq to sql. In my code behine I have

Dim db As New ReservationsDataContext
Dim qd = From d In db.Inventories _
Where d.Depart = DDLFrom.SelectedValue And d.GoesTo.Contains(sSearchTo) _
Order By d.dDate _
Select _
DepartDay = d.DOW & "-" & d.dDate

Dim qa = From r In db.Inventories _
Where r.Depart = DDLTo.SelectedValue And r.GoesTo.Contains(sSearchFrom) _
Order By r.dDate _
Select _
DepartDay = r.DOW & "-" & r.dDate

DDLLeaveDay.DataSource = qd
DDLLeaveDay.DataBind()

DDLArriveDay.DataSource = qa
DDLArriveDay.DataBind()

I'm getting the error: System.Web.HttpException: DataBinding: 'System.String' does not contain a property with the name 'DepartDay'. on ther bold line above. What step am I missing?

Diane
mainship
 
Posts: 6
Joined: Fri 27 Mar 2009 01:38

Postby AndreyR » Thu 02 Apr 2009 13:50

Could you please send me a small test project illustrating the problem?
I failed to reproduce this problem in my environment.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16


Return to LinqConnect (LINQ to SQL support)