Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to make the textbox value center when clicking on the button in C# with web form?

What I have tried:

btnCenter.Style = "TextBox-HorizontalAlign: Center";
Posted
Updated 20-Dec-17 17:11pm
Comments
j snooze 20-Dec-17 17:15pm    
have you tried setting the css of the text box to "text-align: center"
an0ther1 20-Dec-17 18:45pm    
Look at your code... You are applying the style to the button, not the text box.
Secondly, Text boxes do not have a property for horizontal alignment so you have another problem there.

You may be able to achieve it via CSS but perhaps re-thinking your design is a better option

1 solution

try
TextBox1.Style.Add("text-align", "center");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900