473,396 Members | 1,891 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.

Dynamic Gridview Header Wrap Text

Hi I have a Gridview, where I create dynamic headers on RowCreated. Thats all fine, but the text in the header column doesn't wrap. This makes the columns way to wide. I have tried cell.wrap = true which does nothing. Any help would be appreciated.

Below is the RowCreated code.

Expand|Select|Wrap|Line Numbers
  1.        Dim gvrHeaderGridview3 As New GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert)
  2.                 For colAdd = 0 To 5
  3.                     Dim tblCellAdd3 As New TableCell
  4.                     tblCellAdd3.Wrap = True
  5.                     If colAdd = 0 Then
  6.                         tblCellAdd3.Text = "CPI is used for Baseline for Real Estate Cycle"
  7.                         tblCellAdd3.ColumnSpan = 2
  8.                     ElseIf colAdd = 1 Then
  9.                         tblCellAdd3.Text = "Cycle Duration (4-15 Yrs)"
  10.                         tblCellAdd3.ColumnSpan = 1
  11.                         tblCellAdd3.RowSpan = 3
  12.                     ElseIf colAdd = 2 Then
  13.                         tblCellAdd3.Text = "1st Peak Year Closest" & " " & "to Before / After"
  14.                         tblCellAdd3.Wrap = True
  15.                         tblCellAdd3.Width = 100
  16.                         tblCellAdd3.ColumnSpan = 1
  17.                         tblCellAdd3.RowSpan = 3
  18.                     ElseIf colAdd = 3 Then
  19.                         tblCellAdd3.Text = "Annual Growth in Baseline Up-Cycle"
  20.                         tblCellAdd3.Wrap = True
  21.                         tblCellAdd3.ColumnSpan = 1
  22.                         tblCellAdd3.RowSpan = 3
  23.                     ElseIf colAdd = 4 Then
  24.                         tblCellAdd3.Text = "Annual Growth in Baseline Down-Cycle Deflation"
  25.                         tblCellAdd3.Wrap = True
  26.                         tblCellAdd3.ColumnSpan = 1
  27.                         tblCellAdd3.RowSpan = 3
  28.                     ElseIf colAdd = 5 Then
  29.                         tblCellAdd3.Text = "Annual Slow Down in Trough Deflation"
  30.                         tblCellAdd3.Wrap = True
  31.                         tblCellAdd3.ColumnSpan = 1
  32.                         tblCellAdd3.RowSpan = 3
  33.                     End If
  34.  
  35.                     tblCellAdd3.HorizontalAlign = HorizontalAlign.Left
  36.                     tblCellAdd3.BackColor = colHexDarkBlue
  37.                     tblCellAdd3.BorderStyle = BorderStyle.Outset
  38.                     tblCellAdd3.BorderColor = colHexOrange
  39.                     tblCellAdd3.ForeColor = Drawing.Color.White
  40.                     tblCellAdd3.Font.Bold = True
  41.                     gvrHeaderGridview3.Cells.Add(tblCellAdd3)
  42.                 Next
  43.  
  44.                 CType(gvEconCyclesNormal.Controls(0), Table).Rows.AddAt(0, gvrHeaderGridview3)
  45.  
May 6 '13 #1
0 954

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Mark Rae | last post by:
Hi, Is there a bug in the GridView control specifically related to wrapping of header text...? E.g. the following tag <asp:GridView HeaderStyle-Wrap="false" ID=gvListUsers runat=server ......
0
by: loga123 | last post by:
Hi All, I have a requirement where I need to build a dynamic gridview. I am using asp .net 2.0. I have to display non-key columns of a table in the gridview and make user to be able to...
4
by: Ken Wigle | last post by:
All, I would be very grateful for any help on this question. I have an application in asp.net 2.0 where I dynamically create a datatable and then bind that to a gridview. Unfortunately, the...
0
by: Keithb | last post by:
I have a GridView control with 2 template columns. Both contail a Label control in their ItemTemplate. The right column label wraps text on long strings, the left column just gets wider with long...
4
by: TS | last post by:
I have a headerText for a header column that is "Page<br>Name". it puts a <brto force a line break, but the < and get encoded to &lt; and &gt; thus negating its effect as an html control and doesn't...
7
by: rote | last post by:
I would like to make my Gridview header dynmic i.e databinded from database.. I want my users to be able to change the headers on the fly.. Any ideas?
0
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi misters, I am using a CssClass to fix the gridview header in ASP.Net 2005(C#),which is working fine in IE..But not working in Firefox..This is the cssclass which I'm using right now ...
14
by: agamoto | last post by:
hello guys, i don't know if this is the right tread to post but i have the following problem: i've built a dynamic gridview in run time because the gried values (columns, headers, etc) are...
3
by: ahling | last post by:
Hi again. I have questions to ask. 1. It's not necessary that I write codes to bind the database to the gridview? 2. Why is it that when I try to view the gridview in the browser it shows me...
3
by: raamay | last post by:
I picked up the below code from some website and it is absolutely good working code except that the wrap text feature is not available. The value of field1 below do not go to a new line if the value...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.