2016-08-11 53 views
0

我目前正試圖加入一個asp.net列表框控件內的兩個類屬性。我想顯示日期,然後是否約會是AM/PM。這可能嗎?謝謝多個類屬性顯示在列表框datatextfield

克里斯

Dim lstAppointments As List(Of AppointmentSlotInfo) = New List(Of  AppointmentSlotInfo) 

Dim appointment1 As AppointmentSlotInfo = New AppointmentSlotInfo() 
    With appointment1 
     .AppointmentDate = DateTime.Now 
     .AppointmentTimeSlot = "PM" 
    End With 

Dim appointment2 As AppointmentSlotInfo = New AppointmentSlotInfo() 
    With appointment2 
     .AppointmentDate = DateTime.Now.AddDays(1) 
     .AppointmentTimeSlot = "AM" 
    End With 

lstAppointments.Add(appointment1) 
lstAppointments.Add(appointment2) 

lstAvailableAppointments.DataTextField = "AppointmentDate,AppointmentTimeSlot" 
lstAvailableAppointments.DataSource = lstAppointments 
lstAvailableAppointments.DataBind() 

回答

0

是的,去你的等級和吸氣劑添加屬性。然後,在你的吸氣體中,只寫

String.format("{0} {1}", First Property, SecondProperty); 

然後只要引用那個新的屬性作爲文本字段。

相關問題