473,320 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to Stretch DataGrid at Runtime?

I ahve a page that contains a DataGrid control that is offset from the
left-hand side of the page by about 100 pixels. What I want to do is
stretch the DataGrid to fill the remainder of the page width as the
user resizes the window.

I have tried the following, to no avail:

<SCRIPT language="javascript">
void ResizeGrid() {
document.all.grdManifests.style.width = document.body.clientWidth -
150;
}
</SCRIPT>

<BODY onresize="ResizeGrid()">
..
..
..
</BODY>

Can anyone tell me what I'm doing wrong? Thanks!

Nov 19 '05 #1
1 1859
You could try overriding the TABLE tag created by the DataGrid control
to set the WIDTH="100%" attribute. If it doesn't expose a property to
control this behavior, you probably need to create a new control derived
from DataGrid, and override part of the rendering.

Tyrant Mikey wrote:
I ahve a page that contains a DataGrid control that is offset from the
left-hand side of the page by about 100 pixels. What I want to do is
stretch the DataGrid to fill the remainder of the page width as the
user resizes the window.

I have tried the following, to no avail:

<SCRIPT language="javascript">
void ResizeGrid() {
document.all.grdManifests.style.width = document.body.clientWidth -
150;
}
</SCRIPT>

<BODY onresize="ResizeGrid()">
.
.
.
</BODY>

Can anyone tell me what I'm doing wrong? Thanks!

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kilic Beg via .NET 247 | last post by:
Hi, I am having trouble adding a dropdown to DataGrid at runtime. I create all boundColumns and the TemplateColumn for the dropdown at runtime. The dropdown has a different datasource then the...
3
by: Rameshika | last post by:
Hi All How can I select a particular row in a datagrid.Where when the user double clicks the data in that row should appear in the corresponding text boxes in runtime And how can the user...
5
by: AC | last post by:
Any reason i'm having trouble with: DataGrid1.Columns(7).ItemStyle.HorizontalAlign = HorizontalAlign.Right I'm trying to directly set the column alignment of a datagrid created at runtime.. ...
8
by: Hanson | last post by:
I have a datagrid control in an aspx page. The datagrid columns will be dynamically generated according to the pre-page's search condition, I want to hide some columns in the datagrid. is that...
3
by: John E. | last post by:
I have a datatable that I am binding to a C# ASP.NET 1.1 web page datagrid. I also want to put an "Edit" column on the datagrid. However, whenever I use the following code, it puts the Edit...
2
by: Steve Pierce | last post by:
I am having some issues with a runtime dropdownlist in a datagrid. The issue is that I cannot get ViewState to fill the selected index of a runtime dropdown properly on postback. I do not want to...
4
by: gh | last post by:
I create the columns for the asp.net datagrid at runtime and populates them. I have a template column for checkboxs I created at runtime as well. The user selects the product they want by...
1
by: Antonio | last post by:
Hello, everyone, How do I stretch the cells in a datagrid to the content of the cell? The options in the Property Builder don't seem to have that option. Thanks.
7
by: GaryDean | last post by:
(one of our developers posted this and it got no answer so I'm giving it another try) I'm converting a DataGrid utility component that previously used the columns array to function as it has in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.