2 Replies - 1237 Views - Last Post: 04 May 2013 - 04:22 AM Rate Topic: -----

#1 ddublya  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 27
  • Joined: 16-October 12

Can a dropdown box from one asp section be used to display results...

Posted 03 May 2013 - 01:51 PM

in another asp section?
Im getting an error when I do this but its ok if I keep them in the same asp section.
Im a student and this is a uni project.
<div id="head2">
        Start here:    
    </div>
    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
        <asp:ListItem>Choose a genre</asp:ListItem>
        <asp:ListItem>Chart</asp:ListItem>
        <asp:ListItem>House</asp:ListItem>
        <asp:ListItem>Alternative</asp:ListItem>
        <asp:ListItem>Dubstep</asp:ListItem>
        <asp:ListItem>Drum and Bass</asp:ListItem>
        <asp:ListItem>Techno</asp:ListItem>
    </asp:DropDownList>

</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="center1" runat="server">
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT [Show], [Genre], [Date], [Venue], [Price] FROM [BETable1] WHERE ([Genre] = @Genre)">
        <SelectParameters>
            <asp:ControlParameter ControlID="DropDownList1" Name="Genre" PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" Width="489px">
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <asp:BoundField DataField="Show" HeaderText="Show" SortExpression="Event" />
            <asp:BoundField DataField="Genre" HeaderText="Genre" SortExpression="Genre" />
            <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
            <asp:BoundField DataField="Venue" HeaderText="Venue" SortExpression="Venue" />
            <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
        </Columns>
    </asp:GridView>
</asp:Content>



Sorry missed the first line when copying this so here it is:

<asp:Content ID="Content2" ContentPlaceHolderID="left1" runat="server">



Is This A Good Question/Topic? 0
  • +

Replies To: Can a dropdown box from one asp section be used to display results...

#2 ddublya  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 27
  • Joined: 16-October 12

Re: Can a dropdown box from one asp section be used to display results...

Posted 04 May 2013 - 04:10 AM

Heres the error:


Server Error in '/' Application.
--------------------------------------------------------------------------------


Could not find control 'DropDownList1' in ControlParameter 'Genre'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Could not find control 'DropDownList1' in ControlParameter 'Genre'.

Source Error:


An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:



[InvalidOperationException: Could not find control 'DropDownList1' in ControlParameter 'Genre'.]
System.Web.UI.WebControls.ControlParameter.Evaluate(HttpContext context, Control control) +2155166
System.Web.UI.WebControls.Parameter.UpdateValue(HttpContext context, Control control) +50
System.Web.UI.WebControls.ParameterCollection.UpdateValues(HttpContext context, Control control) +101
System.Web.UI.WebControls.SqlDataSource.LoadCompleteEventHandler(Object sender, EventArgs e) +46
System.Web.UI.Page.onloadComplete(EventArgs e) +9645782
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +867
Was This Post Helpful? 0
  • +
  • -

#3 ddublya  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 27
  • Joined: 16-October 12

Re: Can a dropdown box from one asp section be used to display results...

Posted 04 May 2013 - 04:22 AM

It seems to have issue because the dropbox is in another <asp> section.
I need to reference the left1 <asp> section which holds the filter bar and update a database gridview in the center1 <asp> section.

I was hoping it would be as simple as typing left1.sqldatasource or using Content2/sqldatasource to make the reference but it seems not.

Can anyone shed some light on this - Im stuck.

This post has been edited by ddublya: 04 May 2013 - 04:23 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1