|
| |
|
|
VanessaBurgess
Posts: 5 Joined: 2/29/2008 Status: offline
|
DreamweaverCS3 asp.net asp:dropdownlist - 2/29/2008 13:08:48
Hi there I am trying to create a dropdown list which when a size of product is selected retrieves and displays the product dataset to the same page. I have succeeded with creating the dropdown list and populating it using <%# DataSet1.FieldValue("DispSize", Container) %> and also am able to display the products in the database but am unable to connect the two. I did the same exercise years ago in FP at http://www.countrymun.com/mall/challenger.asp. Am I missing something? Help would be much appreciated. Thanks.
|
|
|
|
rdouglass
Posts: 9167 From: Biddeford, ME USA Status: offline
|
RE: DreamweaverCS3 asp.net asp:dropdownlist - 2/29/2008 14:33:05
Hi and Welcome to OutFront. Can you explain more what you mean about connecting the two? Are you looking to set the dropdown as AutoPostBack or something to that effect? I personally am not clear about what and how you want to connect the two. How about a URL if possible? EDIT: Oh, maybe I should mention that I didn't recognize this was dreamweaver. Sorry...
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
VanessaBurgess
Posts: 5 Joined: 2/29/2008 Status: offline
|
RE: DreamweaverCS3 asp.net asp:dropdownlist - 2/29/2008 15:10:24
Hi Many thanks for your speedy reply and welcoming wishes. What I mean by connecting the two is connecting the dropdown list which when a Size is selected displays the relevant dataset required eg if I select a product size from the dropdown I want to display the relevant product size dataset (which includes the Size and Price as well) only on the same page. Here is the code: <form action="" method="post" name="fORM1" target="_self" id="fORM1" runat="server"> <p> <asp:DropDownList ID="DropDownList1" DataSource="<%# DataSet1.DefaultView %>" DataTextField="DispSize" DataValueField="DispSize" runat="server" AutoPostBack="true"></asp:DropDownList> </p> <ASP:Repeater runat="server" DataSource='<%# DataSet1.DefaultView %>'> <ItemTemplate> <p><%# DataSet1.FieldValue("DispPrice", Container) %><%# DataSet1.FieldValue("DispSize", Container) %></p> </ItemTemplate> </ASP:Repeater> <p><br> </p> </form>
|
|
|
|
rdouglass
Posts: 9167 From: Biddeford, ME USA Status: offline
|
RE: DreamweaverCS3 asp.net asp:dropdownlist - 2/29/2008 16:05:08
quote:
AutoPostBack="true"> OK so the dropdown is AutoPostBack and it look slike they're using the same data source. Without understanding your project, I can only ask if that's really what you want. If it we're me, I'd use a "DataSet2" as well and have it use the dropdown value as a lookup. Here's a quick example of what I mean: <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1"
DataTextField="Name" DataValueField="CompanyID" AutoPostBack="True">
</asp:DropDownList><br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SF %>"
SelectCommand="SELECT [CompanyID], [Name] FROM [tbl_Company]"></asp:SqlDataSource>
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource2">
<ItemTemplate>
<%# Eval("Name")%>
</ItemTemplate>
</asp:Repeater>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:SF %>"
SelectCommand="SELECT [Name], [Address1] FROM [tbl_Company] WHERE ([CompanyID] = @CompanyID)">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" DefaultValue="0" Name="CompanyID"
PropertyName="SelectedValue" Type="Int64" />
</SelectParameters>
</asp:SqlDataSource> See, I used 2 data sources; one for the dropdown and one for the repeater. That help any?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
VanessaBurgess
Posts: 5 Joined: 2/29/2008 Status: offline
|
RE: DreamweaverCS3 asp.net asp:dropdownlist - 3/1/2008 12:17:57
Hi Again Thanks again ... one step forward. Yes, using two datasets has helped but still I am unable to select from the dropdown (DispSize)and display the appropriate dataset. I have reflected again on the FP webpage above and figured that both Datasets need the parameters added so have included those. What I think is missing is some means of the dropdown searching for DispSize and displaying the dataset in a table below. I don't understand what you mean by look up. The Repeater only diplays all the dataset so I have deleted this. Without, it displays the first dataset entry only. What I am trying to achieve is the same functionality as the FP DataBase Results Wizard version above. <MM:DataSet id="DataSet1" runat="Server" IsStoredProcedure="false" ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_connprodACCESS") %>' DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_connprodACCESS") %>' CommandText='<%# "SELECT DispSize FROM HiVisCoat WHERE DispSize = DispSize" %>' Debug="true" > <Parameters> <Parameter Name="@DispSize" Value='<%# IIf((Request.QueryString("DispSize") <> Nothing), Request.QueryString("DispSize"), "DispSize") %>' Type="WChar" /> </Parameters> </MM:DataSet> <MM:DataSet id="DataSet2" runat="Server" IsStoredProcedure="false" ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_connprodACCESS") %>' DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_connprodACCESS") %>' CommandText='<%# "SELECT ""Description"", Discount, DispDepth, DispPrice, DispSize, GirthSizecm, Orderid, Part, Price, ProdSize, Quantity, Taxed, Units, Upsell, URL, Weight FROM HiVisCoat WHERE DispSize = DispSize" %>' CurrentPage='<%# IIf((Request.QueryString("DataSet2_CurrentPage") <> Nothing), Request.QueryString("DataSet2_CurrentPage"), 0) %>' PageSize="10" Debug="true" > <Parameters> <Parameter Name="@DispSize" Value='<%# IIf((Request.QueryString("DispSize") <> Nothing), Request.QueryString("DispSize"), "DispSize") %>' Type="WChar" /> </Parameters> </MM:DataSet> <MM:PageBind runat="server" PostBackBind="true" />
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|