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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:16:58+00:00 2026-06-17T06:16:58+00:00

I have the following sql query that I want to display in a gridview,

  • 0

I have the following sql query that I want to display in a gridview, basically to fields joined.

How can I do this?

SELECT 
--RTRIM(C.CustomerFirstName) + ' ' + LTRIM(C.CustomerLastName) as CustomerFullName,
C.CustomerCompany,
C.CustomerPosition, 
C.CustomerCountry, 
C.CustomerProvince, 
C.CustomerContact,
CP.ActionDate, 
CP.ProductCode,
CP.CustomerEmail
     FROM tblCustomers C
    INNER JOIN 
    tblCustomerProducts CP ON 
C.CustomerEmail = CP.CustomerEmail
     ORDER BY ActionDate DESC

this is the html for the grid view. Basically I want CustomerFirstName and CustomerLastName in one field

<asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" 
        GridLines="None" Width="231px" AutoGenerateColumns="False">
        <RowStyle BackColor="#EFF3FB" />
        <Columns>
            **<asp:BoundField DataField="CustomerFirstName" HeaderText="Name" />
            <asp:BoundField DataField="CustomerLastName" HeaderText="Last Name" />**
            <asp:BoundField DataField="CustomerCompany" HeaderText="Company/Organisation" />
            <asp:BoundField DataField="CustomerPosition" HeaderText="Position" />
            <asp:BoundField DataField="CustomerCountry" HeaderText="Country" />
            <asp:BoundField DataField="CustomerProvince" HeaderText="Province" />
            <asp:BoundField DataField="CustomerContact" HeaderText="Contact" />
            <asp:BoundField DataField="CustomerEmail" HeaderText="Email Address" />
            <asp:BoundField DataField="ActionDate" HeaderText="Action Date" />
            <asp:BoundField DataField="ProductCode" HeaderText="Product code" />
        </Columns>
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#2461BF" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
  • 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-17T06:16:59+00:00Added an answer on June 17, 2026 at 6:16 am

    What you want is to use an <asp:templatefield>instead of the <asp:boundfield>

    Step 2 in the link above shows one way of using the templatefield. Here is another:

    <columns>
        <asp:TemplateField  HeaderText="Name">
        <ItemTemplate>
            <div><%#Eval("CustomerFirstName")%>, <%#Eval("CustomerLastName")%></div>
        </ItemTemplate>
    <asp:BoundField>
    ....
    </columns>
    

    I added the <div> and , to show you can use basic text and html in your <ItemTemplate>.

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

Sidebar

Related Questions

I have the following SQL query that I want to do using Core Data:
I have the following SQL query that performs horribly due to the select count(1)
I have the following SQL query: DECLARE @MyVar datetime = '1/1/2010' SELECT @MyVar This
I currently have the following SQL query that lists all the names of all
I have following SQL query SELECT TOP 10000 AVG(DailyNodeAvailability.Availability) AS AVERAGE_of_Availability FROM Nodes INNER
I have the following SQL query: SELECT r.BEZEICHNUNG AS BEZEICHNUNG, r.ID AS ID, ra.BEZEICHNUNG
I have the following SQL query SELECT r.BEZEICHNUNG AS BEZEICHNUNG, r.ID AS ID, ra.BEZEICHNUNG
I have the following sql query and I want to filter the results where
Let's say I have the following SQL query SELECT id, name, title, description, time
I have the following SQL Server query: SELECT area FROM places WHERE REPLACE(area,'-',' ')

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.