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

  • SEARCH
  • Home
  • 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

Have been learning ASP.NET (using C#) over the past few days. I have made
I'm learning asp.net. I have question about example buttons I can use two types
I am learning asp.net MVC, as I have been using the sqlconnection, sqlcommands etc
I am learning ASP.NET MVC now a days and I have found that most
I am learning ASP.NET and would like to know what are the must have
I am learning ASP.Net. I have a dynamically created ImageButton that I would like
Does anyone have any recommendations of resources for learning ASP.NET specifically? I have a
I really like the MVC way and have actually enjoyed learning ASP.NET MVC (I
I've just started learning ASP.net and I can't seem to get the GridView to
I'm learning ASP.net and I've been playing around with themes and master pages. I

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.