Left Align Text In Server Button

  • Thread starter Thread starter DM
  • Start date Start date
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
 
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
 
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.
 
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
 
=?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.
 
Back
Top