div and datagrid

G

Guest

Hello

<div style="BORDER-RIGHT: thin groove; BORDER-TOP: thin groove; Z-INDEX:
212; LEFT: 8px; OVERFLOW: auto; BORDER-LEFT: thin groove; WIDTH: 680px;
BORDER-BOTTOM: thin groove; POSITION: absolute; TOP: 544px; HEIGHT: 314px">

I used this Div on top of my datagrid so that datagrid can be shown in
horizontal scroll bar. It works fine, my data grid can show max 10 lines, my
problem is, when datagrid does not have 10 lines but 5 lines, the horizontal
bar will be 5 lines below. SO how can I make Div size change based on the
number of lines shown?
Thanks,
Jim.
 
B

Bruce Barker

use client script for this. resize the div based on the size of its content.
look at the doc's for the dom object model.


-- bruce (sqlwork.com)
 
Joined
May 17, 2006
Messages
1
Reaction score
0
Server-side resize

You can make your div a server-side control. Then after you get your datasource back get a row count and pass it to a function. You'll have to experiment a little but then after you do your calculations on based on the row count set the style.item("height") on your div to that value. Each row on a datagrid is a different height based on the info in the row.

Private Sub resizeDiv(ByVal iCount As Int32)
Dim iHeight As Integer

If iCount <> 0 Then
If iCount = 1 Then
iHeight = 85
ElseIf iCount = 2 Then
iHeight = iCount * 70
Else
iHeight = iCount * 60
If iHeight > 350 Then
iHeight = 350
End If
End If
Else
iHeight = 65
End If

div1.Style.Item("HEIGHT") = iHeight.ToString

End Sub

I guess this is one way!?!?!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,197
Latest member
ScottChare

Latest Threads

Top