On your original post you were referring to asp:Button. Here you are referring to HTML button. In HTML button, as far as I know, there is no role attribute. It may be a custom attribute. If you tell me what you are trying to achieve, I may be able to show
you another way to achieve it.
gotroots
Member
478 Points
277 Posts
Using span within a button control
Feb 12, 2012 03:29 PM|LINK
Hi
Simple enough question I think. Im using a span tag within a button control but I cant seem to enclose it correctly.
<asp:Button ID="Button1" CssClass="showhide" OnClick="return false;" runat="server" <span> class="showhide-text">Show more</span> />I have tried to add the approbiate closing tags but I cant seem to get it to work for me.
Thanks if you can help.
karang
Contributor
2439 Points
918 Posts
Re: Using span within a button control
Feb 12, 2012 03:42 PM|LINK
What exactly you want to do? If you want to add span in button text then change your code to
<asp:Button ID="Button1" CssClass="showhide" OnClick="return false;" runat="server"
class="showhide-text" Text="<span>Show more</span>" />
or if you want to enclosed button inside the span you can do that
<span>
<asp:Button ID="Button1" CssClass="showhide" OnClick="return false;" runat="server"
class="showhide-text" Text="Show more" />
</span>
Please let me know your exact requirement
Karan Gupta
http://gyansangrah.com
Please click "Mark as Answer" if this helped you.
Ruchira
All-Star
42887 Points
7020 Posts
MVP
Re: Using span within a button control
Feb 12, 2012 03:45 PM|LINK
You totally can't do this. You are trying to enclose a control tag before closing it within another control tag which is not allowed in HTML.
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.gotroots
Member
478 Points
277 Posts
Re: Using span within a button control
Feb 12, 2012 04:18 PM|LINK
Hi there
Here is the sample code that I want to bring into my asp page
What changes should i make to the code to use it in VS.
Its plain html I believe, although what role="button" is unclear to me.
Ruchira
All-Star
42887 Points
7020 Posts
MVP
Re: Using span within a button control
Feb 12, 2012 04:22 PM|LINK
Hi,
On your original post you were referring to asp:Button. Here you are referring to HTML button. In HTML button, as far as I know, there is no role attribute. It may be a custom attribute. If you tell me what you are trying to achieve, I may be able to show you another way to achieve it.
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.gotroots
Member
478 Points
277 Posts
Re: Using span within a button control
Feb 12, 2012 04:30 PM|LINK
I am trying to use the sample code from the following link:
http://sethstevenson.net/youtube-show-more-button/
I dont think I need to change much other than modify it to use in a asp.net webpage.
gotroots
Member
478 Points
277 Posts
Re: Using span within a button control
Feb 12, 2012 09:03 PM|LINK
Just got it to work.
Thank you for your help non the less.
morrisandy
Member
30 Points
46 Posts
Re: Using span within a button control
Nov 26, 2012 01:18 AM|LINK
Thanks so much for posting your results. This was MOST HELPFUL. jeez!