Solved

change alignment of template column (textbox) in Datagrid

Posted on 2003-11-17
3
640 Views
Last Modified: 2011-09-20
Hi,

I have a datagrid with several template columns that are databound.  I was able to change the alignment of the template columns IF the control is a  label but if it is a textbox it doesn't change it.  Anyone has an idea how to change it during design time or run time?  Thanks.

0
Comment
Question by:IceMan713
3 Comments
 
LVL 8

Expert Comment

by:Dranizz
ID: 9766844
Windows application or Web application?

Cause in Windows Application, you can do this with the tablestyle and columnStyle's properties.

0
 
LVL 1

Author Comment

by:IceMan713
ID: 9767486
I'm sorry I was not clear in my first comment, this is for a Web application.
0
 
LVL 5

Accepted Solution

by:
mondayblueboy earned 250 total points
ID: 9768439
You can use css style,

Design time:
http://experts-exchange.com/Web/Web_Languages/Q_20680435.html

Run time:
First you need to use FindControl method to get reference to the TextBox control. And then use the Styles property to change the alignment.
      TextBox1.Style.Add("text-align", "right")

Reference:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuicssstylecollectionclasstopic.asp
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question