Using Inner HTML with an ASP:Button?

How can I convert

<button type="submit" class="blue">

Into an asp button?

<asp:Button ID="Button1" runat="server" Text="Button" />

<asp:LinkButton ID="LinkButton1" runat="server" CssClass="blue"><span>Login</span></asp:LinkButton>

I just simply cannot find a way to do it. Sorry its a crappy question, but it's throwing me for a loop, might just need to sleep on it.


If you really need rich formatting either you use a css class and define all styling in the css side or you can use an html anchor

I am not aware of another way to compose the inner html of a button or linkbutton like you are trying to do.

I agree with Davide that CSS is the best solution but if you have some styling requirement which requires multiple tags then LinkButton is your best bet. You can apply all the styles you would to have put on 'button' tag on to the 'a' tag.

    <asp:LinkButton ID="submit" runat="server" OnClick="Submit_Click" CssClass="block-button">
        <span runat="server" ID="submitText" ClientIDMode="Static" class="block-button-text">Submit</span><span class="block-button-arrow">&nbsp;</span>

If you really must have a button tag then the only way is to create a custom control that implements all the functionality of asp:button

See here for a solution by prabhakarbn

Need Your Help

Alternative to View for complex Data?

sql sql-server sql-server-2005 tsql triggers

I have a table that contains partial data that is of no use to the user viewing my application. The viewer wants to see a similar table that has all the values calculated out, and wants to be able to

Why does - always return NO for UITextField?

iphone ios uikit uitextfield uikeyinput

Why does -[UIKeyInput hasText] always return NO for UITextField? Is this a bug with UIKit?