By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,156 Members | 1,026 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,156 IT Pros & Developers. It's quick & easy.

html table

P: n/a
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
Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
JV
what style attrs do you have set on this datagrid?

"CalSun" <ca****@gmail.com> wrote
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

Nov 19 '05 #2

P: n/a
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

"JV" <jo**********@goisc.com> wrote in message
news:Ob**************@TK2MSFTNGP10.phx.gbl...
what style attrs do you have set on this datagrid?

"CalSun" <ca****@gmail.com> wrote
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


Nov 19 '05 #3

P: n/a
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.

"CalSun" wrote:
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

"JV" <jo**********@goisc.com> wrote in message
news:Ob**************@TK2MSFTNGP10.phx.gbl...
what style attrs do you have set on this datagrid?

"CalSun" <ca****@gmail.com> wrote
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



Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.