controlling panel width from code

  • Thread starter Thread starter dba56
  • Start date Start date
D

dba56

I have a panel containing textboxes and buttons which I use as a
header for a datagrid on a webform. I would like the panel width to
match the datagrid width. The datagrid width grows depending on the
data being displayed. I tried setting the panel style width to the
datagrid width after the datagrid is bound. But the panel is being set
to the datagrid width I set at design time, not the actual datagrid
width once it has been rendered. I suspect that there may be a way to
do this using Javascript and will experiment. I was just wondering if
anyone has done something like this. Any guidance or advice would be
greatly appreciated.
 
Don't do this sort of things in javascript. You should align your controls
properly in tables. Put the panel and the datagrid in the same column in an
html table and the browser will do the job for you nicely.

Eliyahu
 
Eliyahu,

It works perfectly. I set the width of the panel and datagrid to 100%,
put them in the same column of a table with one row and they always
align.

Thanks again.

Lou
 
Back
Top