Need help with Gridview column width.

  • Thread starter Thread starter Durango2008
  • Start date Start date
D

Durango2008

Hi, I am having a bit of trouble with my gridview table and the width of the
columns.
The gridview is made of Templates that contain LinkButton controls. The
LinkButtons will display a string based on their "text" property.
I have set a width for the Linkbutton control, and I am also using CSS to
set style word-wrap:break-word so that if there is a long string it will
break the word and wrap it. This works fine, however the column-width is
resized so that it fits the original long string rather than resizing it to
fit the wrapped text width.
I am wondering if there is a way to have fixed-width columns so regardless
of how long the string is the column does not resize? If not, is there a
way to remedy this?

If what I wrote is vague please let me know I will try to get a screenshot.

Here is some code to illustrate what I have:

<asp:TemplateField HeaderText="Algorithm" SortExpression="Algorithm"
ItemStyle-CssClass="linkButton">
<EditItemTemplate>
<asp:TextBox ID="txtAlgEdit" runat="server" Height="60px" MaxLength="255"
TextMode="Multiline" Text="AVeryVeryVeryVeryLongWord" />
</EditItemTemplate>

<ItemTemplate>
<asp:LinkButton ID="lblAlgorithm" runat="server" width="80px" Height="80px"
ForeColor="Black" Font-Underline="false" Text="AVeryVeryVeryVeryLongWord"/>
</ItemTemplate>
</asp:TemplateField>

Thank you for any help.
 
Hi,

If you want a fixed width of columns of your grid view ..
Select gridview task of gridview .. click edit columns
and select your template column
after that navigate to style property of template column
you will find four option to modify your footer,header,control and
item
provide appropriate width to each of the styles...

Best of luck

Munna

www.munna.shatkotha.com/blog
www.munna.shatkotha.com
www.shatkotha.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top