Solved

change alignment of template column (textbox) in Datagrid

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

Suggested Solutions

Title # Comments Views Activity
No row return after calling the fillschema method 4 40
Linq Help 1 35
Error on link 14 38
Javascript and Jquery not firing 9 42
IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

895 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