我有一个ListView我把WhereParameters
LinqDataSource
但selected="True"
不反映从提取物。列表视图没有选择默认值
下面是代码:
<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="AptDataContext"
EnableDelete="True" EnableInsert="True" EnableUpdate="True" EntityTypeName=""
TableName="Apointement"
Where="@IsAvailable = True && @dateApt >= DateTime.Now">
<WhereParameters>
<asp:ControlParameter
Name="doctorName"
ControlID="DropDownList1"
PropertyName="SelectedValue"
Type="String" />
</WhereParameters>
</asp:LinqDataSource>
<div class="center">
<asp:Label ID="lblChoseDoctor" runat="server" Text="Choose a Doctor Name"> </asp:Label>
<div class="value-right">
<asp:DropDownList ID="DropDownList1" runat="server" Width="180px" AutoPostBack="true"
OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" >
<asp:ListItem selected="True" Text="DoctorA" Value="DoctorA" /> <=== should select
<asp:ListItem Text="DoctorB" Value="DoctorB" /> doctor A
<asp:ListItem Text="DoctorC" Value="DoctorC" />
</asp:DropDownList>
</div>
</div>
当我执行这一点,选择的所有医生。它应该只选择DoctorA
和IsAvailable >= today date
。这不起作用,因为我在LinqDatasoure中添加了Where="@IsAvailable = True && @dateApt >= DateTime.Now
。
我想也把
DefaultValue="DoctorA"
<asp:ControlParameter
,但它也没工作。
感谢
你可以发布你的DropDownList选择索引更改方法的代码吗? – jadarnel27