Solved

change alignment of template column (textbox) in Datagrid

Posted on 2003-11-17
3
644 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Congratulations! You’re Certified – Now What?

Starting a new career can be overwhelming. Becoming certified in your field of expertise is a great start, but where do you go from here?  Here are some tips to help you on your career journey.

Question has a verified solution.

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

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.   …
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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

623 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