Cell Height

Discussion in 'ASP .Net Datagrid Control' started by JOhn, Sep 30, 2003.

  1. JOhn

    JOhn Guest

    Hi,
    I have a datagrid on a form in VS.NET. When the grid has
    5 or so items in it the cell height looks great. However,
    sometims the grid only has 1 or 2 rows. When this happens
    the cell heights get real tall and it looks stupid. Is
    there some way to specify that the cell heights should be
    constant. I looked at the properties and nothing jumped
    out as an obvious answer. I have one template column with
    a checkbox in it and 5 databound columns.
    I hope the answer will be in VS.NET since I don't want to
    muck around with the html.

    Thanks,
    john
    JOhn, Sep 30, 2003
    #1
    1. Advertising

  2. Hi John,

    I have not been able to reproduce your problem. I dragged a datagrid onto a
    form and filled it from the Pubs database. I tried it with a dozen records
    and then again with just two. In both cases the row height was the same.

    Can you post instructions for reproducing your problem?

    Here are the instructions to reproduce my test.

    * drag a datagrid onto a web form.
    * add the following to the code-behind (and adjust the connection string as
    needed). This will select two records from the pubs database.

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    If Not IsPostBack Then
    Bind()
    End If
    End Sub

    Private Sub Bind()
    Dim Qry1 As System.Data.SqlClient.SqlDataReader
    Dim connectionString As String = "server='localhost';
    trusted_connection=true; Database='pubs'"
    Dim sqlConnection As System.Data.SqlClient.SqlConnection = New
    System.Data.SqlClient.SqlConnection(connectionString)
    Dim queryString As String = "SELECT top 2 au_id, au_lname, au_fname FROM
    authors"
    Dim sqlCommand As System.Data.SqlClient.SqlCommand = New
    System.Data.SqlClient.SqlCommand(queryString, sqlConnection)
    sqlConnection.Open()
    Qry1 =
    sqlCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
    DataGrid1.DataSource = Qry1
    DataGrid1.DataBind()
    Qry1.Close()
    sqlCommand.Dispose()
    sqlConnection.Close()
    sqlConnection.Dispose()
    End Sub


    Thank you, Mike
    Microsoft, ASP.NET Support Professional

    Microsoft highly recommends to all of our customers that they visit the
    http://www.microsoft.com/protect site and perform the three straightforward
    steps listed to improve your computer’s security.

    This posting is provided "AS IS", with no warranties, and confers no rights.


    --------------------
    > Content-Class: urn:content-classes:message
    > From: "JOhn" <>
    > Sender: "JOhn" <>
    > Subject: Cell Height
    > Date: Tue, 30 Sep 2003 13:56:27 -0700
    > Lines: 14
    > Message-ID: <0ac401c38795$50b87a90$>
    > MIME-Version: 1.0
    > Content-Type: text/plain;
    > charset="iso-8859-1"
    > Content-Transfer-Encoding: 7bit
    > X-Newsreader: Microsoft CDO for Windows 2000
    > Thread-Index: AcOHlVC4m5hOpfY4SdC3Grg27KkNfA==
    > X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    > Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    > Path: cpmsftngxa06.phx.gbl
    > Xref: cpmsftngxa06.phx.gbl

    microsoft.public.dotnet.framework.aspnet.datagridcontrol:6836
    > NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
    > X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    >
    > Hi,
    > I have a datagrid on a form in VS.NET. When the grid has
    > 5 or so items in it the cell height looks great. However,
    > sometims the grid only has 1 or 2 rows. When this happens
    > the cell heights get real tall and it looks stupid. Is
    > there some way to specify that the cell heights should be
    > constant. I looked at the properties and nothing jumped
    > out as an obvious answer. I have one template column with
    > a checkbox in it and 5 databound columns.
    > I hope the answer will be in VS.NET since I don't want to
    > muck around with the html.
    >
    > Thanks,
    > john
    >
    Mike Moore [MSFT], Sep 30, 2003
    #2
    1. Advertising

  3. JOhn

    Alvin Bruney Guest

    This happens because you have set a height on the datagrid property sheet
    remove that height and compress the datagrid as far short as it will go.
    that will fix the problem. with the height, the contents are stretched to
    honor the height requirements dynamically.
    hope this helps
    "JOhn" <> wrote in message
    news:0ac401c38795$50b87a90$...
    > Hi,
    > I have a datagrid on a form in VS.NET. When the grid has
    > 5 or so items in it the cell height looks great. However,
    > sometims the grid only has 1 or 2 rows. When this happens
    > the cell heights get real tall and it looks stupid. Is
    > there some way to specify that the cell heights should be
    > constant. I looked at the properties and nothing jumped
    > out as an obvious answer. I have one template column with
    > a checkbox in it and 5 databound columns.
    > I hope the answer will be in VS.NET since I don't want to
    > muck around with the html.
    >
    > Thanks,
    > john
    Alvin Bruney, Oct 1, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    548
  2. Wotney
    Replies:
    1
    Views:
    526
    Flinky Wisty Pomm
    Oct 25, 2006
  3. tshad
    Replies:
    1
    Views:
    1,687
    bruce barker
    Mar 8, 2007
  4. JC

    textbox height = containing cell height - x

    JC, Jul 29, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    175
    DujHoD
    Aug 2, 2004
  5. Replies:
    2
    Views:
    242
    Thomas 'PointedEars' Lahn
    Aug 5, 2008
Loading...

Share This Page