Using internal HTML with ASP: Button?
How can i convert
<button type="submit" class="blue"> <span>Login</span> </button>
The 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 can't find a way to do this. Sorry, this is a hefty question, but it throws me for a cycle, maybe you just need to sleep on it.
+4
2 answers
I agree with Davide that CSS is the best solution, but if you have any style requirement that requires multiple tags, then LinkButton is your best bet. You can apply all the styles that you would put in the 'button' tag 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"> </span> </asp:LinkButton>
If you really have a button tag, the only way is to create a custom control that implements all asp: button functions
See prabhakarbn solution here http://forums.asp.net/t/1496938.aspx/1
+7