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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:39:47+00:00 2026-05-27T06:39:47+00:00

I have ASP.NET GridView in my web app and would like to bind two

  • 0

I have ASP.NET GridView in my web app and would like to bind two fields into one column and use string formatting. I am providing example below, is it possible to implement into GridView?

I have two data fields Name and DefaultParam and would like to display these fields into one GridView column.

Like this

Name=DefaultParam

If DefaultParam value is empty I would like to show only Name value and do not include =

I was using Repeater and code below to achieve this but now decided to move data display to GridView

<%#Eval("Name")%>
<%# (!string.IsNullOrEmpty(Eval("DefaultParam").ToString())) ? "= " + Eval("DefaultParam"):"" %>
  • 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-27T06:39:48+00:00Added an answer on May 27, 2026 at 6:39 am

    You can use a TemplateField and put your logic in there:

    <asp:TemplateField HeaderText="Header">
    <ItemTemplate>
    <%#Eval("Name") + (!string.IsNullOrEmpty(Eval("DefaultParam").ToString())) ? "= " + Eval("DefaultParam"):""%>
    </ItemTemplate>
    </asp:TemplateField>
    

    Another option would be to use a Property on your object to do that logic for you behind the scenes and just use that as a BoundField, but you didn’t mention what the object is your binding is.

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

Sidebar

Related Questions

I have an ASP.NET(2.0 using C#) web app, in which I have a gridview.
I have ObjectDataSource and GridView on one of the pages of my asp.net web
I have one button and one gridview in my asp.net web page.I give the
i have gridview in my asp.net webform. i bind my database to gridview like
I have an ASP.NET GridView which has columns that look like this: | Foo
I have a ASP.NET GridView with a column mapped to a boolean. I want
I have an ASP.NET GridView control in a Web Form. For the sake of
I have a GridView with a row number (Container.DataItemIndex) column in ASP.NET (1,2,3,4, ...)
Just starting with ASP.NET and find it difficult to use the GridView. I have
I have an ASP.NET 2.0 (C#) web app, and in it I have a

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.