Solved

change alignment of template column (textbox) in Datagrid

Posted on 2003-11-17
3
638 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now