473,589 Members | 2,498 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic Gridview Header Wrap Text

14 New Member
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 962

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

Similar topics

2
5782
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 ... etc .... > does not prevent the header text from wrapping.
0
1120
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 delete/update/ or insert new records to the gridview. I want to build SQL queries dynamically in the code based on user input and attach them to gridview...instead of using GUI.
4
8320
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 date column always shows the date and time while I just want the short date. I have tried applying a format string {0:d} but to no avail. I saw a lot of posts regarding the htmlencode property but I do not know how to turn that off for a...
0
2745
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 strings. I have <ItemStyle Wrap="true" /on both column TemplateFields; however it makes no difference either way. As far as I can tell, the properties and styles for both columns are the same. How can I get the left column to wrap text the way the...
4
9448
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 respect the line break I'm guessing this happens during render. What do i need to do to keep the line break?
7
12948
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
1912
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 WrapperDiv { background-image: url(tdbg.jpg); color: #002F5C;
14
15054
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 conditioned with values that come from the database. I used TemplateField's to do that. i don't have a active connection to the database. i store my information to a dataset and bind it to the gridview another thing is that all rows in m gridview are...
3
4329
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 a blank page? How to overcome that? Write codes...? If it is true that we have to include codes, how to code? Because currently there is no data in the database for the gridview and when I attempt to view it, it gives me a blank page. Thanks.
3
5887
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 is long instead it overlaps to the next column. Therefore, i would like to request if anybody could give me a piece of code to solve this issue. <?php require('fpdf.php'); class PDF extends FPDF { //Page header
0
8357
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8223
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6634
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
3847
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
3887
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2372
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
1
1459
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1196
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.