How to set height/width of Gridview and Panel control?

J

JB

Hello

I am using ASP.Net web page (C# codebehind with javascript) that
contains an <asp:GridView> control which should have height = 50px and the
width = 1150px. This <asp:GridView> resides inside of an <asp:panel>
control which should also be height=50px and width=1150px. It looks like
this on the web page source code:

<table id="Pscont">
<tr>
<td>
<asp:panel ID="Pspan" runat="server">
<asp:GridView ID="PsGrid" Width="1150px" Height="50px"
runat="server">
</asp:GridView>
</asp:panel>
</td>
</tr>
</table>

The codebehind looks like this:
if (!Page.IsPostBack)
{
//Pspan.Height = new Unit("50px");
GetData fillGrid = new GetData();
PsGrid.DataSource = fillGrid.loadGrid();
PsGrid.DataBind();
}

I even have a CSS file that contains this:
#PsGrid
{
position:absolute;
top:325px;
left:13px;
height:auto;
}

However none of these works the GridView spreads all over the whole web page
to the bottom of the page. How can I make the GridView comform to the size
that I am setting it to?
 
E

Ed Murphy

JB said:
I am using ASP.Net web page (C# codebehind with javascript) that
contains an <asp:GridView> control which should have height = 50px and the
width = 1150px. This <asp:GridView> resides inside of an <asp:panel>
control which should also be height=50px and width=1150px. It looks like
this on the web page source code:

<table id="Pscont">
<tr>
<td>
<asp:panel ID="Pspan" runat="server">
<asp:GridView ID="PsGrid" Width="1150px" Height="50px"
runat="server">
</asp:GridView>
</asp:panel>
</td>
</tr>
</table>

The codebehind looks like this:
if (!Page.IsPostBack)
{
//Pspan.Height = new Unit("50px");
GetData fillGrid = new GetData();
PsGrid.DataSource = fillGrid.loadGrid();
PsGrid.DataBind();
}

I even have a CSS file that contains this:
#PsGrid
{
position:absolute;
top:325px;
left:13px;
height:auto;
}

However none of these works the GridView spreads all over the whole web page
to the bottom of the page. How can I make the GridView comform to the size
that I am setting it to?

You should be able to wrap it inside a <div> with max-height.
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top