473,418 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Gridview and Setting column width problem

I'm setting the column with for a gridview (25+- columns) and have
paging turned on.

When the gridview is first displayed, the column widths are all set to
the default. But after paging to another page, the widths are set as
they should be.

Going back to page one, the widths are still correct.

Not a clue what's going on here!

<asp:GridView ID="GridView1" runat="server" Style="z-index: 100;
left: 0px; position: absolute; top: 103px; width:2900; "
SkinID="GridSkin" DataSourceID="SqlDataSource1"
AutoGenerateColumns="False"
AllowPaging="True" AllowSorting="True"
EnableSortingAndPagingCallbacks="True" PageSize="4" >
<Columns>
<asp:BoundField DataField="Flood" HeaderText="Flood"
SortExpression="Flood" HtmlEncode="False" >
<ItemStyle HorizontalAlign="Center" Width="50px" />
<HeaderStyle Width="50px" />
</asp:BoundField>
.............

Any ideas about what I'm missing??

chuck

Aug 28 '06 #1
4 15267
I had a problem similar to this. I found that, unlike other style settings,
custom column widths get reset on each postback with the
GridView control. I solved the problem by reseting them on each postback in
the Page_Load event before my !IsPostBack test. I could
have also put that in OnInit I suppose.

I don't know if this is a bug or by design.
--
Regards,
Gary Blakely
Dean Blakely & Associates
www.deanblakely.com

"Chuck" <ch**********@gmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
I'm setting the column with for a gridview (25+- columns) and have
paging turned on.

When the gridview is first displayed, the column widths are all set to
the default. But after paging to another page, the widths are set as
they should be.

Going back to page one, the widths are still correct.

Not a clue what's going on here!

<asp:GridView ID="GridView1" runat="server" Style="z-index: 100;
left: 0px; position: absolute; top: 103px; width:2900; "
SkinID="GridSkin" DataSourceID="SqlDataSource1"
AutoGenerateColumns="False"
AllowPaging="True" AllowSorting="True"
EnableSortingAndPagingCallbacks="True" PageSize="4" >
<Columns>
<asp:BoundField DataField="Flood" HeaderText="Flood"
SortExpression="Flood" HtmlEncode="False" >
<ItemStyle HorizontalAlign="Center" Width="50px" />
<HeaderStyle Width="50px" />
</asp:BoundField>
............

Any ideas about what I'm missing??

chuck

Aug 28 '06 #2
arrrrrrgh. I tried the page_load before the is_postback.
No change.

Adding "TABLE { table-layout:fixed; }" to the css file solved the
problem for me, but created another. Now the paging numbers are
justified across the page, instead of being grouped to the left. Wish
I could figure out what I'm doing wrong.

chuck
GaryDean wrote:
I had a problem similar to this. I found that, unlike other style settings,
custom column widths get reset on each postback with the
GridView control. I solved the problem by reseting them on each postback in
the Page_Load event before my !IsPostBack test. I could
have also put that in OnInit I suppose.

I don't know if this is a bug or by design.
--
Regards,
Gary Blakely
Dean Blakely & Associates
www.deanblakely.com

"Chuck" <ch**********@gmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
I'm setting the column with for a gridview (25+- columns) and have
paging turned on.

When the gridview is first displayed, the column widths are all set to
the default. But after paging to another page, the widths are set as
they should be.

Going back to page one, the widths are still correct.

Not a clue what's going on here!

<asp:GridView ID="GridView1" runat="server" Style="z-index: 100;
left: 0px; position: absolute; top: 103px; width:2900; "
SkinID="GridSkin" DataSourceID="SqlDataSource1"
AutoGenerateColumns="False"
AllowPaging="True" AllowSorting="True"
EnableSortingAndPagingCallbacks="True" PageSize="4" >
<Columns>
<asp:BoundField DataField="Flood" HeaderText="Flood"
SortExpression="Flood" HtmlEncode="False" >
<ItemStyle HorizontalAlign="Center" Width="50px" />
<HeaderStyle Width="50px" />
</asp:BoundField>
............

Any ideas about what I'm missing??

chuck
Aug 29 '06 #3
I'm wondering if the Page_Load event is getting executed each time the user
changes pages. You could put a stop on that code to see.

--
Regards,
Gary Blakely
Dean Blakely & Associates
www.deanblakely.com
"Chuck" <ch**********@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
arrrrrrgh. I tried the page_load before the is_postback.
No change.

Adding "TABLE { table-layout:fixed; }" to the css file solved the
problem for me, but created another. Now the paging numbers are
justified across the page, instead of being grouped to the left. Wish
I could figure out what I'm doing wrong.

chuck
GaryDean wrote:
>I had a problem similar to this. I found that, unlike other style
settings,
custom column widths get reset on each postback with the
GridView control. I solved the problem by reseting them on each postback
in
the Page_Load event before my !IsPostBack test. I could
have also put that in OnInit I suppose.

I don't know if this is a bug or by design.
--
Regards,
Gary Blakely
Dean Blakely & Associates
www.deanblakely.com

"Chuck" <ch**********@gmail.comwrote in message
news:11**********************@p79g2000cwp.googleg roups.com...
I'm setting the column with for a gridview (25+- columns) and have
paging turned on.

When the gridview is first displayed, the column widths are all set to
the default. But after paging to another page, the widths are set as
they should be.

Going back to page one, the widths are still correct.

Not a clue what's going on here!

<asp:GridView ID="GridView1" runat="server" Style="z-index: 100;
left: 0px; position: absolute; top: 103px; width:2900; "
SkinID="GridSkin" DataSourceID="SqlDataSource1"
AutoGenerateColumns="False"
AllowPaging="True" AllowSorting="True"
EnableSortingAndPagingCallbacks="True" PageSize="4" >
<Columns>
<asp:BoundField DataField="Flood" HeaderText="Flood"
SortExpression="Flood" HtmlEncode="False" >
<ItemStyle HorizontalAlign="Center" Width="50px" />
<HeaderStyle Width="50px" />
</asp:BoundField>
............

Any ideas about what I'm missing??

chuck

Aug 29 '06 #4
Yep, the page load is executed when the page loads, and the column,
Item and Header widths are being set. But if I don't have the css
command: TABLE { table-layout:fixed; }, then the column widths are not
set.

But with the css command the widths are set, but the pager line is
justified across the table (which is quite wide).

If there a css command to set the footer for the table??

Wierd.

chuck

GaryDean wrote:
I'm wondering if the Page_Load event is getting executed each time the user
changes pages. You could put a stop on that code to see.

--
Regards,
Gary Blakely
Dean Blakely & Associates
www.deanblakely.com
"Chuck" <ch**********@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
arrrrrrgh. I tried the page_load before the is_postback.
No change.

Adding "TABLE { table-layout:fixed; }" to the css file solved the
problem for me, but created another. Now the paging numbers are
justified across the page, instead of being grouped to the left. Wish
I could figure out what I'm doing wrong.

chuck
GaryDean wrote:
I had a problem similar to this. I found that, unlike other style
settings,
custom column widths get reset on each postback with the
GridView control. I solved the problem by reseting them on each postback
in
the Page_Load event before my !IsPostBack test. I could
have also put that in OnInit I suppose.

I don't know if this is a bug or by design.
--
Regards,
Gary Blakely
Dean Blakely & Associates
www.deanblakely.com

"Chuck" <ch**********@gmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
I'm setting the column with for a gridview (25+- columns) and have
paging turned on.

When the gridview is first displayed, the column widths are all set to
the default. But after paging to another page, the widths are set as
they should be.

Going back to page one, the widths are still correct.

Not a clue what's going on here!

<asp:GridView ID="GridView1" runat="server" Style="z-index: 100;
left: 0px; position: absolute; top: 103px; width:2900; "
SkinID="GridSkin" DataSourceID="SqlDataSource1"
AutoGenerateColumns="False"
AllowPaging="True" AllowSorting="True"
EnableSortingAndPagingCallbacks="True" PageSize="4" >
<Columns>
<asp:BoundField DataField="Flood" HeaderText="Flood"
SortExpression="Flood" HtmlEncode="False" >
<ItemStyle HorizontalAlign="Center" Width="50px" />
<HeaderStyle Width="50px" />
</asp:BoundField>
............

Any ideas about what I'm missing??

chuck
Aug 29 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: hammad.awan_nospam | last post by:
Hello, I am using ASP.NET 2.0. What I have done is nested a gridview inside another column of a gridview using a template data field column declaritively in my web form. Inside this child...
1
by: Miguel Dias Moura | last post by:
Hello, I have a GridView in my page which is created in runtime. It works fine. My page has 2 Asp Buttons: - The HIDE button makes GridView.Visible = False; - The SHOW button makes...
5
by: Steve Bugden | last post by:
Hi, I would like to set the column widths in the ASP.NET GridView control at runtime I have tried the following: http://msdn2.microsoft.com/en-us/library/ms178296.aspx Which uses the...
1
by: Bill44077 | last post by:
I am dynamically adding a checkbox in a gridview and I find there are several things that I cannot figure out how to address. 1. The width of the checkbox column is very wide. I've tried adding...
2
by: Jacksm | last post by:
How can I align an asp:table columns with gridview columns (the widths)? I have tried setting table.column(0).width = gridview.column(0).width at page_load but it doesn't work. Thanks in advance
0
by: landesjoe | last post by:
Hi, here's my problem in short: Text boxes in gridview don't seem to hold their value if the column's .Visible property is changed back and forth. I've got a form with a gridview populated from...
1
by: Jeff | last post by:
ASP.NET 2.0 I've got problems with the right column in my GridView. The GridView consist of 2 columns, the problem column is the column on the right side. The problem is that it looks like...
5
by: mohaaron | last post by:
OK, I have now gone through lots of posts, and there are lots, looking for a anwer as to why I can't set the width of the columns in my gridview. So far I have tried the following methods to set...
4
by: Yin99 | last post by:
I have a Gridview binding to a DataTable source. I'd like to set the column with of the second column. I cannot do this apparently because when AutoGenerateColumns=true, they do not appear in the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.