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 7951857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:41:22+00:00 2026-06-04T02:41:22+00:00

My DetailsView is always blank. I’ve tested both Data Sources in QueryBuilder and they

  • 0

My DetailsView is always blank. I’ve tested both Data Sources in QueryBuilder and they return values. I suspect something is wrong with the parameter value assignments in PoweredEquipDetails where they are set to the SelectedValue in GridView1, but I don’t know why it wouldn’t work.

<body>
 <form id="form1" runat="server">
  <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
    DataSourceID="PoweredEquipHeader" DataKeyNames="Model,Serial">
    <Columns>
        <asp:CommandField ShowSelectButton="True" />
        <asp:BoundField DataField="Model" HeaderText="Model" ReadOnly="True" 
            SortExpression="Model" />
        <asp:BoundField DataField="Serial" HeaderText="Serial" ReadOnly="True" 
            SortExpression="Serial" />
    </Columns>
    <SelectedRowStyle BackColor="#FF6600" />
  </asp:GridView>
  <asp:SqlDataSource ID="PoweredEquipHeader" runat="server" 
    ConnectionString="<%$ ConnectionStrings:CPECConnectionString %>" 
    SelectCommand="Select t1.Model, t1.Serial From Powered_Equip t1 Where TechID = @TechID And Store = @Store">
    <SelectParameters>
        <asp:QueryStringParameter DefaultValue="TECH01" Name="TechID" 
            QueryStringField="Tech" />
            <asp:QueryStringParameter DefaultValue="0000" Name="Store" 
            QueryStringField="Store" />
    </SelectParameters>
  </asp:SqlDataSource>
  <asp:SqlDataSource ID="PoweredEquipDetail" runat="server" 
    ConnectionString="<%$ ConnectionStrings:CPECConnectionString %>" 
    SelectCommand="SELECT t1.Serial, t1.Model, t1.Status, t1.[Trailer VIN], t2.Tag, t2.State, t2.ExpMonth, t2.ExpYear FROM Powered_Equip AS t1 INNER JOIN Trailers AS t2 ON t1.[Trailer VIN] = t2.VIN WHERE (t1.Serial = @Serial) AND (t1.Model = @Model)">
    <SelectParameters>
        <asp:ControlParameter ControlID="GridView1" Name="Serial" 
            PropertyName="SelectedValue" />
        <asp:ControlParameter ControlID="GridView1" Name="Model" 
            PropertyName="SelectedValue" />
    </SelectParameters>
</asp:SqlDataSource>
<asp:DetailsView ID="DetailsView1" runat="server"
    DataSourceID="PoweredEquipDetail" DataKeyNames="Serial,Model">
    <Fields>
        <asp:BoundField DataField="Serial" HeaderText="Serial" ReadOnly="True" 
            SortExpression="Serial" />
        <asp:BoundField DataField="Model" HeaderText="Model" 
            ReadOnly="True" SortExpression="Model" />
        <asp:BoundField DataField="Status" HeaderText="Status" ReadOnly="True" 
            SortExpression="Status" />
        <asp:BoundField DataField="Trailer VIN" HeaderText="Trailer VIN" ReadOnly="True" 
            SortExpression="Trailer VIN" />
        <asp:BoundField DataField="Tag" HeaderText="Tag" ReadOnly="True" 
            SortExpression="Tag" />
        <asp:BoundField DataField="State" HeaderText="State" ReadOnly="True" 
            SortExpression="State" />
        <asp:BoundField DataField="ExpMonth" HeaderText="ExpMonth" ReadOnly="True" 
            SortExpression="ExpMonth" />
        <asp:BoundField DataField="ExpYear" HeaderText="ExpYear" ReadOnly="True" 
            SortExpression="ExpYear" />
    </Fields>
</asp:DetailsView>
</form>

EDIT: So I believe what is happening is the GridView’s SelectedValue in the DetailsView parameter assignments is always Model, instead of both Model and Serial as specified in my DataValueKeys. In the event that an equipment item has a model and serial that are the same value (i.e. Model 118 Serial 118), the DetailsView populates. But in any case where the Model and Serial are different (which will be almost every other case), the DetailsView is blank. So how do I get two different SelectedValues to assign value to two different ControlParameters?

  • 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-06-04T02:41:24+00:00Added an answer on June 4, 2026 at 2:41 am

    Changed

    <SelectParameters>
        <asp:ControlParameter ControlID="GridView1" Name="Serial" 
            PropertyName="SelectedValue" />
        <asp:ControlParameter ControlID="GridView1" Name="Model" 
            PropertyName="SelectedValue" />
    </SelectParameters>
    

    to

    <SelectParameters>
            <asp:ControlParameter ControlID="GridView1" Name="Serial" 
                PropertyName="SelectedDataKey.Values[Serial]" />
            <asp:ControlParameter ControlID="GridView1" Name="Model" 
                PropertyName="SelectedValue" />
        </SelectParameters>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As the DetailsView uses <td> cells for both the header text and the data,
What to do to show DetailsView even when there is no data in underlying
I have a control that look something like this: <asp:DetailsView ID=dvUsers runat=server DataSourceID=odsData DataKeyNames=Id>
I have always used Replace(myString, vbCrLf, <br/>) to show line breaks when outting something
I am using a DetailsView control. Here I have both edit and delete buttons.
I have a DetailsView control that I want to populate with a data table.
I'm trying to pass a value from DetailsView to FormView but I always get
I have a DetailsView with a TextBox and I want the input data be
I have a asp.net detailsview control on a page. I've noticed that it always
I currently have a DetailsView in ASP.NET that gets data from the database based

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.