Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Cell Height

Reply
Thread Tools

Cell Height

 
 
JOhn
Guest
Posts: n/a
 
      09-30-2003
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
 
Reply With Quote
 
 
 
 
Mike Moore [MSFT]
Guest
Posts: n/a
 
      09-30-2003
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(connectionStri ng)
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.CommandBehavi or.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.datagridc ontrol
> Path: cpmsftngxa06.phx.gbl
> Xref: cpmsftngxa06.phx.gbl

microsoft.public.dotnet.framework.aspnet.datagridc ontrol:6836
> NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
> X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridc ontrol
>
> 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
>


 
Reply With Quote
 
 
 
 
Alvin Bruney
Guest
Posts: n/a
 
      10-01-2003
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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cell's offsetHeight not equal to cell's height?? firefox & IE laszlokenez@gmail.com Javascript 2 08-05-2008 10:44 PM
textbox height different than input height tshad ASP .Net 1 03-08-2007 10:04 PM
measuring web controls height at runtime (or converting .height % to px) Wotney ASP .Net 1 10-25-2006 01:39 PM
how to get specific cell height without hard-coding a height value laredotornado@zipmail.com HTML 0 08-19-2006 08:13 PM
textbox height = containing cell height - x JC ASP .Net Web Controls 2 08-02-2004 08:28 PM



Advertisments