Hello, I?m working on a much larger project, but I?m having trouble with a webpart, scroll panel and a gridview; all working in harmony with width=100% (viewable width of the browser). What is happening is the Grid View always wants to be full width not allowing the scroll bars to work causing ie?s scroll at the bottom to come on because it is much larger than 100% of the browsers width. This only happens when the panel is placed in to a webpart. If the panel was outside the webpart it works perfectly. Is this a problem with webparts? I would also like to maintain scrolled position, I don?t know if that changes the situation. I?ve included a small test program called: TestScroll.aspx for anyone that would like to take a stab at my problem. I greatly appreciate all who are trying to help me out, Thanks in advance.
-Nick
<%--TestScroll.aspx--%>
<%@ Page Language="VB" %>
<%@ Import Namespace=System.Data %>
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
GridView1.DataSource = GeneratetTable()
GridView1.DataBind()
End Sub
Function GeneratetTable() As DataTable
Dim dt As New DataTable
dt.Columns.Add(New DataColumn("Column_1", GetType(String)))
dt.Columns.Add(New DataColumn("Column_2", GetType(String)))
dt.Columns.Add(New DataColumn("Column_3", GetType(String)))
Dim dr As DataRow
dr = dt.NewRow()
dr("Column_1") = "A"
dr("Column_2") = "B"
dr("Column_3") = "C"
dt.Rows.Add(dr)
dr = dt.NewRow()
dr("Column_1") = "E"
dr("Column_2") = "F"
dr("Column_3") = "G"
dt.Rows.Add(dr)
Return dt
End Function
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
</head>
<body>
<form id="form1" runat="server">
<asp:WebPartManager ID="WebPartManager1" runat="server">
</asp:WebPartManager>
<asp:WebPartZone ID="WebPartZone1" runat="server" Width="100%">
<ZoneTemplate>
<asp:Panel ID="Panel1" Title="Test Grid" ScrollBars="Auto" Height="100" runat="server">
<%--<div style="overflow:auto;width:100%;height:250px;">--%>
<asp:GridView ID="GridView1" runat="server" GridLines="Vertical" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="Column 1" ItemStyle-HorizontalAlign="Center" ControlStyle-Width="300px">
<ItemTemplate>
<asp:TextBox ID="tbColumn_1" runat="server" Text='<%# Bind("Column_1")%>' Wrap="false" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Column 2" ItemStyle-HorizontalAlign="Center" ControlStyle-Width="300px">
<ItemTemplate>
<asp:TextBox ID="tbColumn_2" runat="server" Text='<%# Bind("Column_2")%>' Wrap="false" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Column 3" ItemStyle-HorizontalAlign="Center" ControlStyle-Width="300px">
<ItemTemplate>
<asp:TextBox ID="tbColumn_3" runat="server" Text='<%# Bind("Column_3")%>' Wrap="false" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<%--</div>--%>
</asp:Panel>
<asp:Panel ID="Panel2" Title="Empty Panel One" runat="server" Height="50px">
</asp:Panel>
<asp:Panel ID="Panel3" Title="Empty Panel Two" runat="server" Height="50px">
</asp:Panel>
</ZoneTemplate>
</asp:WebPartZone>
</form>
</body>
</html>