No DetailsView display on adding FilterExpression
Hi
I have a problem here. I have a DetailsView control, DropDownList control, and 2 AccessDataSource controls named AcDsrcDDL & AcDsrcDV for accessing by DropDownList & DetailsView respectively.
I want to make it work like, I choose the number in the DropDownList(tied to AcDsrcDDL), AcDsrcDV will then get the value(eg: 1190), then filter the database to get the data for allocatedID = 1190 only. However, after I added the codes(in bold), my DetailsView never got displayed at all already.
How can I solve this problem? Thank you!
<asp:AccessDataSource ID="AcDsrcDDL" runat="server" DataFile="~/App_Data/DB.mdb"
SelectCommand="SELECT [allocatedID] FROM [table] ORDER BY [allocatedID]">
</asp:AccessDataSource>
<asp:AccessDataSource ID="AcDsrcDV" runat="server" DataFile="~/App_Data/DB.mdb"
SelectCommand="SELECT * FROM [table] ORDER BY [allocatedID]"
FilterExpression="allocatedID='{0}'">
<FilterParameters>
<asp:ControlParameter Name="allocatedID" ControlID="DropDownList1"
PropertyName="SelectedValue" />
</FilterParameters>
</asp:AccessDataSource>
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
BackColor="LightBlue" Font-Names="Arial Narrow" Height="238px" Style="z-index: 101;
left: 537px; position: absolute; top: 53px" Width="243px" DataSourceID="AcDsrcDV">
</asp:DetailsView>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
DataSourceID="AcDsrcDDL" DataTextField="allocatedID" DataValueField="allocatedID"
Style="z-index: 104; left: 344px; position: absolute; top: 5px">
</asp:DropDownList>
|