Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Gridview-Can't adjust column width

Reply
Thread Tools

Gridview-Can't adjust column width

 
 
msch-prv@bluewin.ch
Guest
Posts: n/a
 
      07-25-2006
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>

 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      07-26-2006
Try css rule tablelayout:fixed

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

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ItemStyle.Width doens't adjust the size of a column? Greg P. ASP .Net Web Controls 14 02-11-2008 07:18 PM
fixed-width column and variable-width columns mixed ssk HTML 5 10-30-2006 07:50 AM
How do I adjust the width of a "submit" button Robert S HTML 8 07-11-2006 01:32 PM
Textbox width scaling to width of data not width of page? AndrewF ASP .Net 1 10-10-2005 04:38 PM
DG Column Width vs Table Column Width Carl Howarth ASP .Net Datagrid Control 1 10-24-2004 08:48 AM



Advertisments