Left Align Text In Server Button

N

Nakul

Hi,

Try this

<asp:Button id="Button1" runat="server" Text="Button" Width="256px"
style="TEXT-ALIGN: left"></asp:Button>

This align the text left for the button

Thanks
Nakul
 
G

Guest

Anybody know how to do this "in the code behind the form"? We have a class defined to handle button mouseover behaviour and the like. We would like the ability to add the text alignment to the form. While editing the HTML does work, it would be easier if we did not have to edit every single button on the web page

Thanks

Timothy Swanso
----- Nakul wrote: ----

Hi

Try thi

<asp:Button id="Button1" runat="server" Text="Button" Width="256px
style="TEXT-ALIGN: left"></asp:Button

This align the text left for the butto

Thank
Naku
 
M

Martin Dechev

Hi, Timothy Swanson,

You can create a style and then assign it to the buttons. something like
this:

<style type="text/css">
..leftAlign
{
text-align: left;
}
</style>

then assign it:

button1.CssClass = "leftAlign";
button2.CssClass = "leftAlign";
etc.

Documentation:
http://msdn.microsoft.com/library/e...uiwebcontrolswebcontrolclasscssclasstopic.asp

Hope this helps
Martin
tswanson said:
Anybody know how to do this "in the code behind the form"? We have a
class defined to handle button mouseover behaviour and the like. We would
like the ability to add the text alignment to the form. While editing the
HTML does work, it would be easier if we did not have to edit every single
button on the web page.
 
G

Guest

Thanks Martin

That is getting closer, but it still involves editing the HTML code
I have tried making definitions in Styles.css and they are all ignored

Are there any other ideas, or should I stick with what works

Thanks again
----- Martin Dechev wrote: ----

Hi, Timothy Swanson

You can create a style and then assign it to the buttons. something lik
this

<style type="text/css"
..leftAlig

text-align: left

</style

then assign it

button1.CssClass = "leftAlign"
button2.CssClass = "leftAlign"
etc

Documentation
http://msdn.microsoft.com/library/e...buiwebcontrolswebcontrolclasscssclasstopic.as

Hope this help
Marti
class defined to handle button mouseover behaviour and the like. We woul
like the ability to add the text alignment to the form. While editing th
HTML does work, it would be easier if we did not have to edit every singl
button on the web page
 
C

Chad Z. Hower aka Kudzu

=?Utf-8?B?dHN3YW5zb24=?= said:
That is getting closer, but it still involves editing the HTML code.
I have tried making definitions in Styles.css and they are all ignored.

Are there any other ideas, or should I stick with what works?

Validate your CSS. When CSS is bad, you dont get errors. It just doesnt work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top