Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid in HTML DIV 1

Status
Not open for further replies.

DLLHell

Programmer
May 9, 2003
69
US
Is it possible to size the DIV length & width based on the size of the Datagrid, horizontally within code? I have a datagrid which's width/length changes.
 
It's possible to resize the <div> through the code, if you run it as a server control:
Code:
<div id=&quot;myDiv&quot; runat=server>

protected System.Web.UI.HtmlControls.HtmlGenericControl myDiv;
myDiv.Attributes.Add(&quot;style&quot;, &quot;width:800px&quot;);
myDiv.Attributes.Add(&quot;style&quot;, &quot;height:600px&quot;);
 
LV - Thanks.

Almost there - without modifying the DIV height & width to match the Grid's height & width, the vertical scroll bar is a inch or so to the right of the Grid... the larger the Grid the closer the scrollbar is.

When modifying the Div's height & width, it places the entire Grid elsewhere outside the Div's original position even though no other DIV parameters other than Height & Width have changed. I guess I'll have to experiment with the Div & Grid parameters.
 
Sorry, just reallized I made a code error, should read:
Code:
myDiv.Attributes.Add(&quot;style&quot;, &quot;width:800px;height:600px;&quot;);
 
LV - Thanks a lot. I just got around to trying it out and it situates the Grid & Div correctly now with the last code you sent. I just got rid of the bottom horizontal scroll but that's only one item in a few things left to do for variable-length grids with autogenerate kept as =true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top