Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Gridview-Can't adjust column width (http://www.velocityreviews.com/forums/t360439-gridview-cant-adjust-column-width.html)

msch-prv@bluewin.ch 07-25-2006 06:31 PM

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>


Eliyahu Goldin 07-26-2006 08:21 AM

Re: Gridview-Can't adjust column width
 
Try css rule tablelayout:fixed

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

<msch-prv@bluewin.ch> wrote in message
news:1153852270.413719.256790@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>
>





All times are GMT. The time now is 09:31 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.