Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 968331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:27:42+00:00 2026-05-16T02:27:42+00:00

I am learning ASP.NET and I have a master-detail scenario using two GridViews in

  • 0

I am learning ASP.NET and I have a master-detail scenario using two GridViews in ASP.NET 3.5 and C#. GridView grdOrders lists a set of orders and the GridView grdOrderDetails lists a set of order details for an order. I have a master page which defines two content areas with this code:

<div class="leftColumn">
    <asp:ContentPlaceHolder id="cphLeftSide" runat="server" />
</div>
<div class="rightColumn">
    <asp:ContentPlaceHolder ID="cphRightSide" runat="server" />
</div>

On my orders.aspx content page I have put the grdOrders GridView in the cphLeftSide content placeholder and GridView grdOrderDetails in the cphRightSide placeholder with code like this:

<asp:Content ID="leftContent" ContentPlaceHolderID="cphLeftSide" runat="server">
    <h2>Orders</h2>
    <asp:GridView ID="grdOrders" DataSourceID="sdsOrders"...></asp:GridView>
<asp:SqlDataSource ID="sdsOrders" runat="server" ConnectionString="<%$ ConnectionStrings:csOrders %>" 
    SelectCommand="usp_GetOrders" SelectCommandType="StoredProcedure">></asp:SqlDataSource>
</asp:Content>

In the rightside I have the orderDetails content with code like this:

<asp:Content ID="rightContent" ContentPlaceHolderID="cphRightSide" runat="server">
    <h2>Order details</h2>
    <asp:GridView ID="grdOrderDetails" DataSourceID="sdsOrderDetails"...></asp:GridView>
<asp:SqlDataSource ID="sdsOrderDetails  runat="server" 
    ConnectionString="<%$ ConnectionStrings:csOrders %>" 
    SelectCommand="usp_GetOrderDetails" SelectCommandType="StoredProcedure">
    <SelectParameters>
        <asp:ControlParameter Name="orderId" ControlID="grdOrders" PropertyName="SelectedDataKey.Value" />
    </SelectParameters>
</asp:Content>

When I run my code I get this error:

Server Error in ‘/Test2’ Application.
Could not find control ‘grdOrders’ in ControlParameter ‘orderId’.
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 ‘grdOrders’ in ControlParameter ‘orderId’.

How do I connect the two data sources? So that when I select an order, it runs the usp_GetOrderDetails stored procedure and binds to the grdOrderDetails GridView? The code runs fine if I put both GridViews and DataSources in the same

<asp:Content> 

tag.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T02:27:42+00:00Added an answer on May 16, 2026 at 2:27 am

    When your Order gridview is selected (whatever the event is called — onSelected or something), do this in your code-behind:

    • sdsOrderDetails.parameters(“orderID”).defaultvalue = grdOrders.selectedvalue

    That’s just psuedo, but hopefully clear enough.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Where can I find a good tutorial on learning ASP.NET MVC using VB.net 2008
I've just been learning about master pages in ASP.NET 2.0. They sound great, but
I'm learning ASP.NET MVC Framework, From some articles like this , it seems that
I'm learning ASP.NET MVC and bugged by one issue. In the HomeController, the Index
I'm still learning ASP.NET and I often see code like this throughout parts of
I'm just learning asp.net mvc and I'm trying to figure out how to move
Im in the process of learning asp.net 3.5, currently on webparts and co. Ive
I would like to start learning ASP.NET on a for-fun project. I'm hoping to
I've been learning the new ASP.NET MVC framwork lately and I've developed a test
I just uploaded my first ASP.NET (as part of my learning of vb.net) and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.