473,725 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with Gridview column width.

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:TemplateFi eld HeaderText="Alg orithm" SortExpression= "Algorithm"
ItemStyle-CssClass="linkB utton">
<EditItemTempla te>
<asp:TextBox ID="txtAlgEdit " runat="server" Height="60px" MaxLength="255"
TextMode="Multi line" Text="AVeryVery VeryVeryLongWor d" />
</EditItemTemplat e>

<ItemTemplate >
<asp:LinkButt on ID="lblAlgorith m" runat="server" width="80px" Height="80px"
ForeColor="Blac k" Font-Underline="fals e" Text="AVeryVery VeryVeryLongWor d"/>
</ItemTemplate>
</asp:TemplateFie ld>

Thank you for any help.
Jul 3 '08 #1
1 2176
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,c ontrol 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
Jul 3 '08 #2

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

Similar topics

0
2208
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 gridview I have set an ItemStyle property of width 20% for the first templated field which contains a hyperlink control, and an ItemStyle of width 80% for the second templated field which contains a label. Both of these controls are databound to...
2
4456
by: rufpirat | last post by:
Hello I'm in the middle of trying to build an "AD phone book", and this being my first try at asp.net, I have a few questions that I hope some of you might be able to help with: 1. Is it correct, that PageSize equals the max size of the result set? 2. Is there a way to make asp cache the search result, so the domain controller won't be to bother by all the lookups, and also to speed up
1
9354
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 GridView.Visible = True. I press HIDE and the GridView disappears as expected. After it I press SHOW and the GridView doesn't show.
1
5929
by: msch-prv | last post by:
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...
1
2873
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 properties and Item Style to the column but it has no effect. Is there someway to size this column to be smaller? I removed the CssClass property and it had no effect on the size as well. 2. The gridview is sortable using javascript. Is there...
1
2000
by: Jeff | last post by:
ASP.NET 2.0 I've got problems with the Width of the ImageMap below. The problem is that the ImageMap's Width doesn't have any effect in my GridView, the width are determine by width of the column and the with of the div (the div the ImageMap is included in). In the code below the column & div has Width of 300px and ImageMap has Width of 130, but when the page holding this GridView is displayed then the Width is 300 on the ImageMap. I...
2
5675
by: =?Utf-8?B?c3Jpbml2YXM=?= | last post by:
Hi All, I'm having a grid view(GridView1) with a hyperlink column.It's ID is Link1 I want to show a popup on hyperlink click. I'm using ajaxToolkit:ModalPopupExtender for that. But when i'm using TargetControlID="Link1" for ajaxToolkit:ModalPopupExtender I'm getting an error System.InvalidOperationException: The TargetControlID of 'ModalPopupExtender1' is not valid. A control with ID 'Link1' could not be found.
1
6734
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 there is a huge space between the 2 columns, see the huge grey space between the 2 columns. I want the columns to be very close to each other with only 10px open space between the columns. Now it looks like there is a 160px margin between them
1
1847
nitindel
by: nitindel | last post by:
Hi All, Please tell me any good site for Gridview control.(not for datagrid). I am facing error in fetching the values of the Bound columns in the gridview: lease tell me how should i fetch the value..of a bound column..?? Below is the code.:
0
8888
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
6702
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.