473,666 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGrid Header and Text Alignment

Is there anyway to align HeaderText different from text in the column. I want my text to be right aligned and headertext to be center. I don't want to add blank spaces in HeaderText as I am using a function which autoresizes the column.

thanks

Jul 21 '05 #1
2 1767
Hi,

DataGrid has HeaderStyle property. Couldn't you do the alignment with it?

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
"PankajBang a" <Pa*********@di scussions.micro soft.com> wrote in message
news:55******** *************** ***********@mic rosoft.com...
Is there anyway to align HeaderText different from text in the column. I want my text to be right aligned and headertext to be center. I don't want
to add blank spaces in HeaderText as I am using a function which autoresizes
the column.
thanks

Jul 21 '05 #2
ah, sorry for that.

Have you tried asking this at Windows Forms Forums:
http://www.windowsforms.net/forums/

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
"Job Lot" <Jo****@discuss ions.microsoft. com> wrote in message
news:74******** *************** ***********@mic rosoft.com...
I am talking Windows Form DataGrid Control and Web Forms

"Teemu Keiski" wrote:
Hi,

DataGrid has HeaderStyle property. Couldn't you do the alignment with it?
--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
"PankajBang a" <Pa*********@di scussions.micro soft.com> wrote in message
news:55******** *************** ***********@mic rosoft.com...
Is there anyway to align HeaderText different from text in the column.
I want my text to be right aligned and headertext to be center. I don't want to add blank spaces in HeaderText as I am using a function which autoresizes the column.

thanks


Jul 21 '05 #3

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

Similar topics

2
4675
by: Jim Dougherty | last post by:
I am using c#.net 2003 and have an an application with a datagrid. The binding is with an array of structs. Everything works ok except the header text is the struct element names and they override any GridColumnStyles properties I set. Additionally, the GridColumnStyles width I set does not get updated on the datagrid. Any other user have this problem or some insight into what may be going on. Thanks, Jim
2
1522
by: Stan Sainte-Rose | last post by:
Hello, I need to know how to format Integer and Real with the datagrid. In fact, I want to use the right alignment. When I use this option the header text comes with the right alignment too. :( Another question with datagrid, is there a way to have "blank lines". I mean I would like to have (n) lines displayed even if they are empty (like an excel page). Just for the design.
2
2114
by: pmcguire | last post by:
I have derived a ComboBoxColumnStyle that inherits DataGridColumnStyle. It works fine except for one behavior. If the user selects a new value from the ComboBox's pulldown list on a brand new record, the ComboBoxColumn's Commit event doesn't fire. If the user first edits a TextBox cell on the same New row, and THEN selects a new value for the ComboBox cell, Commit fires. What is going on and how do I get around it Thanks Pat
1
2358
by: jimb | last post by:
I can get the dropdownlist into the datagrid, and I can populate it, but I can't read it. Anybody have a working example of a dropdownlist in an editable grid? Thanks. -- .. http://sf-f.org, weblog and search engine for fans and writers of
5
1139
by: EdB | last post by:
1) How do I make the contents of a Windows datagrid editable while at the same time preventing new rows from being added? 2) How do I align the contents of a column align-right, but the header of that same column align-left?
13
2472
by: pmcguire | last post by:
I have a DataGrid control for which I have also created several new extended DataGridColumnStyles. They behave pretty nicely, but I can't figure out how to implement Selected Item formatting for them. In a plain vanilla DataGrid, when you click on the RowHeader, the appropriate row changes colors. I ASSUME this should be done in the Paint (or PaintText) override of the DataGridColumnStyle in question. My problem is that I don't know...
0
1263
by: Sam | last post by:
Hi guys, I tried to use DataGridTextBoxColumn alignment property to format my data in the datagrid and I don't quite get what I'd like it to be. The problem is that when I set the alignment property to alignment right, the column header text gets so close to the right edge of the column header and that makes it difficult to read. Am I missing something? Thanks
2
8083
by: John Smith | last post by:
Hi all; Putting "Due" into the column header of a datagrid. Font is a proportional fort. When the alignment is left, there is some space between the column separator bar and the D in Due. When the alignment is center, Due is centered in the header box. When the alignment is right, the e in Due is partially covered by the column separator bar. Adding space after Due (i.e.. "Due ") does not work. HeaderText seems to be trimmed before...
3
4173
by: Simon Abolnar | last post by:
Is it possible to align headers and text in different way. Because with: dgts.GridColumnStyles(0).Alignment = HorizontalAlignment.Center alignment is set for all column (header and text). Thanks for help! Simon
7
1967
by: Doug Bell | last post by:
Hi Does anyone know (or point me where I can find) how to set the alignment of a DataGrid Column Header different to the alignment of the column. I am trying to show some Right aligned columns and the header looks wrong squashed to the right. If I could even add a trailing space but it trims any trailing spaces off. Thanks
0
8863
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...
0
8780
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
8549
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
8636
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
7378
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...
1
6189
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
5661
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
4358
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2005
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.