|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Adding Scroll Bar to DataGrid: Height Problem
Hi,
I have added scroll bar to a datagrid using div tag: <div style="OVERFLOW:auto;HEIGHT:360px"> {datagrid code} </div> I am getting the data from the db. So the restult set will be different in size everytime. If I fix the height to 360px, i have a problem if the result set only contains few items. say 1 or 2. However, since the width is 360px, so it adds empty sapce to make it to 360px. How can i fix this spacing problem. Please reply. Regards, Babneet |
|
#2
|
|||
|
|||
|
Solving Height Problem
One easy advice would be, after binding the datagrid find the height of the grid and set the height of the DIV accordingly.
To achieve this declare the DIV as runat="server" and give it a ID such as DIV1 After binding the datagrid do the following String DataGridHeight = DataGrid1.Height.ToString(); DIV1.Style.Add("height", DataGridHeight); ------- Rezaul Kabir |
|
#3
|
|||
|
|||
|
Hi Kabir,
How can I access the DIV1 in the code behind? say <div> tag has id DIV1. I have to declair it, like we do for Label. and also everytime I do dataGrid.Height.toString(), it is empty string. Cheers, Babneet |
|
#4
|
|||
|
|||
|
Thanks
Do not worry. It is working now.
Thanks for your help. Babneet |
![]() |
| Viewing: Dev Articles Community Forums > Programming > .NET Development > Adding Scroll Bar to DataGrid: Height Problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|