p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Basics (http://p2p.wrox.com/forumdisplay.php?f=136)
-   -   No DetailsView display on adding FilterExpression (http://p2p.wrox.com/showthread.php?t=61570)

yukijocelyn August 28th, 2007 10:15 PM

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>


All times are GMT -4. The time now is 09:02 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.