473,396 Members | 2,013 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,396 software developers and data experts.

Gridview-Can't adjust column width

I have difficulties adjusting the column width of a gridview control.
The column width changes appear in the design grid, but at run-time the
width changes back to what I presume are the grid's default settings.

Idem for the pager settings: the page settings are spread over the grid
width (justified) instead of being grouped on the left hand side. I
tried changing various settings and adding some CSS to no avail.

Thanks for any suggestions Mark

Code:
<div style=" background-color: #CCFFFF; padding: 0.5em; border:1px
solid; font-size: small; ">

<asp:GridView ID="grdTasks1" AllowPaging="True"
AutoGenerateColumns="False"
EmptyDataText="No records found" PageSize="5"
runat="server" OnPageIndexChanging="grdAct_PageIndexChanging"
AllowSorting="True"
DataKeyNames="ActID,ActDueDay"
OnSorting="grdAct_Sorting"
OnSelectedIndexChanged="grdAct_SelectedIndexChange d"
CaptionAlign="Left" Caption="Grid" GridLines="None"
CellPadding="2" PagerStyle-HorizontalAlign="Left">

<Columns>

<asp:BoundField DataField="PrjDesc1" HeaderText="Project"
HeaderStyle-Width="25px" SortExpression="PrjDesc1" />

<asp:BoundField DataField="ActAssgnN" HeaderText="Assignee"
HeaderStyle-Width="25px" SortExpression="ActAssgnN" />

<asp:BoundField DataField="ActStat" HeaderText="Status"
SortExpression="ActStat" />

<asp:BoundField DataField="FromName" HeaderText="From"
SortExpression="FromName" />

<asp:BoundField DataField="ActDueDay" HeaderText="Due Day"
SortExpression="ActDueDay" />

<asp:BoundField DataField="ActPrio" HeaderText="Priority"
SortExpression="ActPrio" />

</Columns>

<PagerSettings Mode="NumericFirstLast" />
</asp:GridView>
</div>

Jul 25 '06 #1
1 5907
Try css rule tablelayout:fixed

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

<ms******@bluewin.chwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
>I have difficulties adjusting the column width of a gridview control.
The column width changes appear in the design grid, but at run-time the
width changes back to what I presume are the grid's default settings.

Idem for the pager settings: the page settings are spread over the grid
width (justified) instead of being grouped on the left hand side. I
tried changing various settings and adding some CSS to no avail.

Thanks for any suggestions Mark

Code:
<div style=" background-color: #CCFFFF; padding: 0.5em; border:1px
solid; font-size: small; ">

<asp:GridView ID="grdTasks1" AllowPaging="True"
AutoGenerateColumns="False"
EmptyDataText="No records found" PageSize="5"
runat="server" OnPageIndexChanging="grdAct_PageIndexChanging"
AllowSorting="True"
DataKeyNames="ActID,ActDueDay"
OnSorting="grdAct_Sorting"
OnSelectedIndexChanged="grdAct_SelectedIndexChange d"
CaptionAlign="Left" Caption="Grid" GridLines="None"
CellPadding="2" PagerStyle-HorizontalAlign="Left">

<Columns>

<asp:BoundField DataField="PrjDesc1" HeaderText="Project"
HeaderStyle-Width="25px" SortExpression="PrjDesc1" />

<asp:BoundField DataField="ActAssgnN" HeaderText="Assignee"
HeaderStyle-Width="25px" SortExpression="ActAssgnN" />

<asp:BoundField DataField="ActStat" HeaderText="Status"
SortExpression="ActStat" />

<asp:BoundField DataField="FromName" HeaderText="From"
SortExpression="FromName" />

<asp:BoundField DataField="ActDueDay" HeaderText="Due Day"
SortExpression="ActDueDay" />

<asp:BoundField DataField="ActPrio" HeaderText="Priority"
SortExpression="ActPrio" />

</Columns>

<PagerSettings Mode="NumericFirstLast" />
</asp:GridView>
</div>

Jul 26 '06 #2

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

Similar topics

0
by: JMax | last post by:
Hello! I have a GridView that has another GridView embedded in it. The embedded GridView has some complex editing features (requiring JavaScript duplicating drop down lists), so I have to use...
1
by: syl | last post by:
Hello I am trying to create a "easy to use" gridview with filters (dropdownlist in headers), sorting...and much more.... In order to do that, i prefer to use a objectdatasource (ODS) beacause...
8
by: Greg Lyles | last post by:
Hi all, I'm trying to develop an ASP.NET 2.0 website and am running into some real problems with what I thought would be a relatively simple thing to do. In a nutshell, I'm stuck on trying to...
1
by: rn5a | last post by:
I was using a DataView to bind records from a DB table to a DataGrid using the following code: Dim sqlDapter As SqlDataAdapter Dim dSet As DataSet Dim dView As DataView sqlDapter = New...
4
by: Tomasz | last post by:
Hello Developers, Here is interesting problem I just came across: how do I wire a GridView control programmatically? Here is my sample code using Object Data Source: protected void...
5
by: =?Utf-8?B?QWRhciBXZXNsZXk=?= | last post by:
Hi All, I have a GridView inside the EditItemTemplate of a FormView. Both FormView and GridView are data bound using an ObjectDataSource. When the FormView's ObjectDataSource object has a...
2
by: Blasting Cap | last post by:
I've got a gridview (that I converted over from a datagrid, which had been working properly), that is doubling up the number of rows returned. When it was running as a datagrid, the same code sent...
1
Frinavale
by: Frinavale | last post by:
I'm working on an ASP.NET application using VB.NET for server side code. I have a GridView listing a bunch of stuff. Above the GridView I have a checkbox named "ChkBx_SelectAll". If this...
5
by: Eric | last post by:
Hi, there are several gridviews all with a linkbutton which all trigger the same procedure. I need to know from which gridview the linkbutton has been clicked. Thanks Eric Here the code:
0
by: cmrhema | last post by:
Hi, I have a gridview problem while binding more than two gridviews. I am giving a sample scenario of what I have done so far I have two tables First table: Department , having columns...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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...

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.