The content inside the button slightly shifts or moves downward by a few pixels.
<div>
<asp:Button runat="server" ID="Button1" CssClass="ButtonClass" Text="" runat="server" />
</div>
ascx.cs:
Button1.Text = LocalizationResourceManager.GetLocalizedValue("Button_Text");
CSS:
.ButtonClass{
background: url('/Button.png') no-repeat scroll 0 0 transparent;
cursor: pointer;
font-weight: bold;
font-size: 14px;
height: 33px;
padding-bottom: 7px;
padding-right: 19px;
width: 180px;
border: solid 0px;
color: #fff!important;
background-position: 0px -31px;
}
If I could use a <span>
, this could have been resolved with:
{position:relative;top;0;left:0;}
As span
cannot be utilized within an asp:button
, I need to find a solution for this button itself.
I attempted:
<asp:LinkButton ID="Button1" runat="server" CssClass="ButtonClass">
<span runat="server" id="ButtonText"></span>
</asp:LinkButton>
ascx.cs:
ButtonText.text = LocalizationResourceManager.GetLocalizedValue("Button_Text");
An error is occurring:
Error 9 'System.Web.UI.HtmlControls.HtmlGenericControl' does not contain a definition for 'text' and no extension method 'text' accepting a first argument of type 'System.Web.UI.HtmlControls.HtmlGenericControl' could be found (are you missing a using directive or an assembly reference?)
What am I overlooking in this situation?