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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:25:00+00:00 2026-05-17T21:25:00+00:00

I have a GridView that needs to display either x amount of columns from

  • 0

I have a GridView that needs to display either x amount of columns from the GridView, or just one column (cell) which will expand to take up the entire row. Deciding which to display is done by checking if that one column is blank or not – if it is blank, display the other cells, or if not, just display that one cell.

How would I go about doing this? I’m using an SqlDataSource to select the contents of the GridView but I’m willing to change this for a more programmatic approach.

Thanks

  • 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-17T21:25:00+00:00Added an answer on May 17, 2026 at 9:25 pm

    I’m not sure if I understand you correctly, but if you want you can build your Table yourself. Then you can control exactly what columns (and what data) to include.

    Table table = new Table();
    table.GridLines = GridLines.None;
    table.CellPadding = 3;
    table.CellSpacing = 0;
    
    // add a header
    TableHeaderRow header = new TableHeaderRow();
    foreach (string header in new string[] { "column1", "column2" }) {
        TableCell cell = new TableCell();
        cell.Text = header;
        header.Cells.Add(cell);
    }
    // add data
    foreach (var rowd in data) {
        TableRow row = new TableRow();
        foreach (string columnData in new string[] { rowd.Column1, rowd.Column2 }){
            TableCell cell = new TableCell();
            cell.Text = columnData;
            row.Cells.Add(cell);
        }
        table.Rows.Add(row);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview where one column is going to be a hyperlink that
I have a GridView that displays data on three columns. On the third column
Need some help with DataFormatString in GridView. I have a Double value that needs
I have a GridView that allows editing the values in every column, in every
I have a gridview that shows an image as part of one of its
I have a gridview that displays items details, I added two template fields one
I have a bound field in my Gridview which is getting its value from
I have a page which has a GridView on it, which is populated from
I have a gridview which I am using to display a dataset result. The
I have an ASPX GridView with a DetailsRow which I need to display some

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.