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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:24:03+00:00 2026-05-23T15:24:03+00:00

I have a gridview that imports data from a remote database, this is working

  • 0

I have a gridview that imports data from a remote database, this is working fine. The data populates and I can manipulate it easily enough. There seems to be issues with the spacing of the columns. They are not giving enough space for all the text to fit in one line of each cell (the width of the column seems to stop at a certain point which isn’t the same for every column). This also has the effect of adding a lot of extra space in each cell in which the text only does take up one line.

When i click on the edit button, all auto-sizing works absolutely perfectly and the text is all line up in one cell, with no forced line breaks. Once I hit ‘cancel’ and go back to the standard grid view display (ie. ‘edit’ not clicked) the sizing/space issues comes back.

Here is my code:

<asp:SqlDataSource ID="coverAllDataSource" runat="server"
                ConnectionString="Data Source=blah; Initial Catalog=blah; User Id=blah;              Password=blah"
                SelectCommand="SELECT * FROM blah"
                />
                Search by -&nbsp;
                <asp:DropDownList ID="ddlCoverAll" runat="server" Width="148px">
                </asp:DropDownList>
                <br /><br />
                <div style="overflow:auto;max-width:650px; max-height: 400px; border: 1px solid black">
                    <asp:GridView ID="coverAllGV" DataSourceID="coverAllDataSource" runat="server" 
                        BorderStyle="None" AllowSorting="True" 
                        AutoGenerateEditButton="True" CellPadding="0" DataMember="DefaultView" 
                        ShowFooter="True">
                        <AlternatingRowStyle BackColor="#FF9900" />
                        <EditRowStyle Wrap="False" />
                    </asp:GridView>
                </div>

So I am not entirely sure why this is happening, it is my understanding that the gridview will automatically size the column width to accommodate the specific columns largest body of text, but this does not seem to be working correctly. To make things even more confusing, sometimes the auto-sizing chooses to set its width based on a column header, but other times it decides to set its width based on the cell with the largest amount of text within it.

Such a simple thing to get stuck on, alas I cannot resolve this and I’ve spent way too much time trying to (trying to build a gridview on an empty page without divs or manipulation from an external css file, etc)….it’s probably something way too simple.

Anyways, if someone could guide me in the rite direction it would be rather appreciated.

Thanks in advance!

  • 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-23T15:24:04+00:00Added an answer on May 23, 2026 at 3:24 pm

    all line up in one cell, with no forced line breaks

    If you just want the text to stop wrapping you can achieve this with some CSS. Give your GridView a class name like CssClass="gridview" and then add a CSS rule to your stylesheet, something like:

    .gridview td { white-space : nowrap; }
    

    This will tell the table to not wrap any of the text in the table cells. If you are still having problems you want want try try removing the max-width from your wrapping div or decreasing the text size.

    If you want to be able to set the width of each column manually set AutoGenerateColumns to false and add the columns with a specified width (you can do this either using the GUI or manually on the aspx page).

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

Sidebar

Related Questions

I have a gridview that displays data that I retrieved from a database along
I have a GridView that pulls data out of the database and populates its
I have GridView that allows select. It takes data from EntityDataSource . How do
I have a gridview control that can get loaded with multiple pages worth of
I have a GridView that is bound to a select statement from a table.
I have a GridView that needs to display either x amount of columns from
I have this GridView that have it's DataSource as a list of previously selected
I have a gridview that contains data. I want the user to be able
I have a gridview that displays the contents of a database table, using an
I have a gridview that contains one linkbutton within itemtemplate. I bind this gridview

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.