0
我想顯示在我的列表視圖中的DoctorId鍵字段,它總是出現空白。ID鍵沒有顯示在列表視圖
這裏是.aspx頁面中
<asp:LinqDataSource ID="LinqDataSource1" runat="server"
ContextTypeName="AppointementDataContext" EnableDelete="True" EnableInsert="True"
EnableUpdate="True" EntityTypeName="" TableName="Appointement"
Where="IsAvailable = True && dateApt >= DateTime.Now && doctorId = Doctor.Id &&
doctorid = 1">
<WhereParameters>
<asp:ControlParameter
Name="doctor_name"
ControlID="DropDownList1"
PropertyName="SelectedValue"
Type="String" />
</WhereParameters>
</asp:LinqDataSource>
<asp:ListView ID="ListView1" runat="server" DataKeyNames="aptId"
DataSourceID="LinqDataSource1" InsertItemPosition="LastItem" >
<AlternatingItemTemplate>
<tr style="">
<td>
<asp:Label ID="lblDoctorId" runat="server" Value='<%# Eval("doctorId") %>' />
</td>
<td>
<asp:Label ID="DoctorNameLabel" runat="server"
Text='<%# Eval("Doctor.Doctor_Name") %>' />
</td>
<td>
<asp:Label ID="dateAptLabel" runat="server"
Text='<%# Eval("dateApt", "{0:dd/MM/yyyy}") %>' />
</td>
<td>
<asp:Label ID="hourAptLabel" runat="server"
Text='<%# Eval("hourApt", @"{0:hh\:mm}") %>' />
</td>
<td>
<asp:CheckBox id="MyCheckBox" runat="server"
value='<%# Eval("aptId") %>'
AutoPostBack="true"
OnCheckedChanged="Check_Clicked" />
</td>
</tr>
</AlternatingItemTemplate>
<ItemTemplate>
<tr style="">
<td>
<asp:Label ID="lblDoctorId" runat="server" Value='<%# Eval("doctorId") %>' />
</td>
<td>
<asp:Label ID="DoctorNameLabel" runat="server"
Text='<%# Eval("Doctor.Doctor_Name") %>' />
</td>
<td>
<asp:Label ID="dateAptLabel" runat="server"
Text='<%# Eval("dateApt", "{0:dd/MM/yyyy}") %>' />
</td>
<td>
<asp:Label ID="hourAptLabel" runat="server"
Text='<%# Eval("hourApt", @"{0:hh\:mm}") %>' />
</td>
<td>
<asp:CheckBox id="MyCheckBox" runat="server"
value='<%# Eval("aptId") %>'
AutoPostBack="true"
OnCheckedChanged="Check_Clicked" />
</td>
</tr>
</ItemTemplatee>
所有領域都走出來,除了doctorID正確的價值觀。
這裏是我的Appointement.designer.cs
public partial class Doctor : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new
PropertyChangingEventArgs(String.Empty);
private int _Id;
private string _Doctor_name;
private EntitySet<Appointement> _Appointement;
public partial class Appointement : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new
PropertyChangingEventArgs(String.Empty);
private int _aptId;
private System.Nullable<int> _clientId;
private int _doctorId;
private System.DateTime _dateApt;
private System.TimeSpan _hourApt;
private System.Nullable<bool> _IsAvailable;
private EntityRef<Doctor> _Doctor;
醫生名稱是走出所以它以某種方式連接正確。我不明白爲什麼doctorId或Doctor.Id沒有顯示在Listview上。
這裏是Appointement.dbml是如何定義: Appointement表(aptId,的clientId,doctorId,dateApt,hourApt,IsAvailable) 醫生表(ID,doctor_name)
我在設計模式中注意到了Appointement.aspx我的專欄DoctorId沒有顯示DataBound。任何關於如何使用DataBound的想法?
感謝