Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add space before asp.net label in c#

Tags:

c#

asp.net

label

I want to add some space before asp.net Label.I can't do this in .aspx ,I want this to be done in c#.How can I add space?? please help me.my label is placed like this:

                    Label Test

I want this to come to centre

                                       Label Test
like image 257
Madhavan NR Avatar asked Jan 13 '23 19:01

Madhavan NR


2 Answers

To add spaces to your label text from c#, you can pre-append many HTML non-breaking spaces by using   Example:

Label1.Text = "     " + Label1.Text;
like image 194
arturogarrido Avatar answered Jan 22 '23 03:01

arturogarrido


Try adding the Css Style or Css Class:-

lblTest.Attributes.CssStyle.Add("margin-left", "<value>");

or

lblTest.Attributes.Add("class","<className>"); and specify the css style in the specified class.

like image 38
Aditya Singh Avatar answered Jan 22 '23 03:01

Aditya Singh