View Single Post
  #1 (permalink)  
Old August 28th, 2007, 10:15 PM
yukijocelyn yukijocelyn is offline
Authorized User
 
Join Date: Aug 2007
Location: , , Singapore.
Posts: 70
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to yukijocelyn
Default 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>
Reply With Quote