473,796 Members | 2,658 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TextBox align=right?

With .NET 2.0:
Is there a way to right align the text in a textbox?
The task is to edit numbers in a table-column, and it looks kind of silly
with the numbers left-aligned.

A label respond to formatting of the table cell, but text within the texbox
doesn't.

Bjorn
Jun 24 '07 #1
4 32021
"Bjorn Sagbakken" <bj*****@online .nowrote in message
news:T8******** *************@t elenor.com...
Is there a way to right align the text in a textbox?
<asp:TextBox ID="MyTextBox" runat="server" style="text-align:right;" />
--
http://www.markrae.net

Jun 24 '07 #2
"Mark Rae" <ma**@markNOSPA Mrae.netwrote in message
news:O6******** ******@TK2MSFTN GP05.phx.gbl...
"Bjorn Sagbakken" <bj*****@online .nowrote in message
news:T8******** *************@t elenor.com...
>Is there a way to right align the text in a textbox?

<asp:TextBox ID="MyTextBox" runat="server" style="text-align:right;" />
Thanks. That worked.
I was looking for something like that but didn't find anything browsing the
properties of the textbox, not even style.

Bjorn
Jun 24 '07 #3
Custom attributes defined on a WebControl's tag would be outputted as-is if
they are not recognized to match any typed property. Although, TextBox does
have Style property, inherited from WebControl and in this case iterating
through TextBox's Style property's keys would show text-align is there if
you specify it declaratively

<asp:TextBox ID="TextBox1" runat="server" style="text-align:right" />

foreach (string key in TextBox1.Style. Keys)
{
//Output the keys
}

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"Bjorn Sagbakken" <bj*****@online .nowrote in message
news:uf******** *************@t elenor.com...
"Mark Rae" <ma**@markNOSPA Mrae.netwrote in message
news:O6******** ******@TK2MSFTN GP05.phx.gbl...
>"Bjorn Sagbakken" <bj*****@online .nowrote in message
news:T8******* **************@ telenor.com...
>>Is there a way to right align the text in a textbox?

<asp:TextBox ID="MyTextBox" runat="server" style="text-align:right;" />

Thanks. That worked.
I was looking for something like that but didn't find anything browsing
the properties of the textbox, not even style.

Bjorn

Jun 24 '07 #4
"Teemu Keiski" <jo****@aspalli ance.comwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
Custom attributes defined on a WebControl's tag would be outputted as-is
if they are not recognized to match any typed property. Although, TextBox
does have Style property, inherited from WebControl and in this case
iterating through TextBox's Style property's keys would show text-align is
there if you specify it declaratively

<asp:TextBox ID="TextBox1" runat="server" style="text-align:right" />

foreach (string key in TextBox1.Style. Keys)
{
//Output the keys
}
Thanks. If I need to check out other keys, I will remember your tip.
I have some textboxes generated dynamically, and now I have applied a line
like this to each one of them:

ItemValue=New TextBox
ItemValue.Style ("text-align")="right"

Bjorn
Jun 24 '07 #5

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

Similar topics

7
6808
by: Phil Powell | last post by:
Code: <!-- script src="/js/val_header.js"></script --> <style> <!-- BODY { scrollbar-3d-light-color:#eeeedd; scrollbar-arrow-color:#000000; scrollbar-base-color:#000000; scrollbar-dark-shadow-color:#eeeedd;
12
95548
by: Ted Mencini | last post by:
When I replaced older <IMG ALIGN=RIGHT ...> tags with a CSS definition <IMG class=right ...> xxx.css: IMG.right { BORDER: 0; align: right } I notice that the effect is NOT the same. While in the past the text was flowing smoothly around the picture on the right side there is now a hard cut: Text, then picture below with white space on the left and finally
8
20034
by: André Hänsel | last post by:
Hi! When I put a table into a table and try to align it right, it works in IE but not in Firefox. Simplest code to reproduce: <html> <body> <table style="width: 100%"> <tr>
1
10979
by: Astra | last post by:
Hi All This has been bugging me for months and I just can't my finger on why it won't work in Safari/FireFox (IE lets me off cos it's nice liek that). In essence, the offending code is as follows: <TD CLASS="NavBarHeaderCellB"> <!-- #include file="../incs/sprocs/fred.asp" --> </TD>
6
1792
by: tshad | last post by:
I have a cell with 2 items in it: a textbox and a link. The link is actually a button (image), but for the example I am using a link, which is doing the same thing. Here is the stripped down version of my page that shows the problem: *********************************************************************************** <html> <head></head>
3
7879
by: Sjef Janssen | last post by:
Is it possible to have a box (div) which sets a background-color and which contains (on the same line) text which is left aligned and text which is right aligned. (as in a table: two td's left one left aligned, right one right aligned). Thanxs!!
1
1316
by: Claudia Fong | last post by:
Hi I add this code in my asp.net file and I can see the text align to the right, but I can't see the difference when I displayed the webpage in my PDA.. so my question is does someone know why? I got mobile 5 in my PDA <asp:TextBox ID="TextBox1" runat="server" style="text-align:right" /> Cheers!
13
2678
by: Roderik | last post by:
Hi, I am wondering why (half of the) squared images are not aligned on the right of the text in Internet Explorer (using <img ... align="right" />. I thought this was supported even in IE. In FF and Opera it works fine. http://www.roderik.net/2008/05/25/robotchallenge-vienna-2008/ Mucht thanks for any suggestions.
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10461
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
10239
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
10190
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
9057
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...
0
6796
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
5447
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4122
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.