html table

C

CalSun

I have a datagrid with about 15 columns bound at run time. I create an html
table and have this datagrid inside.

<table align=center width="90%">
<tr>
<td>
<asp:datagrid ......
...
</asp:datagrid>
</td>
</tr>
</table>

Somehow the datagrid go beyond the screen width. I have to scroll
horizontally to view the last several columns.
I like to have this table 90% of the screen width (any screen, or solution).
Anyone has ideas how to archive this?
--Thanks
 
C

CalSun

thanks JV for replying. Here is the definition part of the datagrid:

<asp:DataGrid Width="100%" id="grid" runat="server"
AutoGenerateColumns="false" CssClass="Shadow"
BackColor="white" CellPadding="2" CellSpacing="2" GridLines="none"
BorderStyle="solid" BorderColor="black"
BorderWidth="1" OnItemCreated="ItemCreated" OnEditCommand="grid_edit"
OnUpdateCommand="grid_update"
OnDeleteCommand="grid_delete" OnCancelCommand="grid_cancel"
OnItemCommand="grid_DelAdd" font-size="x-small"
font-names="verdana" ShowFooter="True">
<AlternatingItemStyle BackColor="palegoldenrod" />
<ItemStyle BackColor="beige" Font-Size="x-small" />
<HeaderStyle ForeColor="white" BackColor="brown" Font-Bold="true" />
<FooterStyle ForeColor="#330099" BackColor="#FFFFCC"></FooterStyle>
<Columns>
...
</asp:DataGrid>

--Cal
 
G

Guest

CalSun,

Instead of using the table width 90% and the datagrid width 100% as shown
in your first post, you may want to directly set the width of the DataGrid to
90% as below
<asp:DataGrid Width="90%" align="center" id="grid" runat="server"

Visual Studio may underline the align attribute with red to indicate it is
wrong , but this will be rendered to following HTML

<table align="center" id="grid" style="width:90%;"

If there are lot of table formattings to do , it is a good idea to consider
asp:repeater instead of DataGrid.
 

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

Top