Hi
I'm having a little problem implementing a custom WebControlAdapter for button. I am following the sliding doors pattern to output the following HTML:
<button value="submit" name="Button1" id="Button1" type="Submit" onclick="__doPostBack('Button1','')"><span>Button</span></button>
in place of the standard:
<input id="Button1" type="submit" value="Button" name="Button1"/>
This is being done (among other reasons) so the button will resize based on the text contained within it, so not purely for aesthetic reasons. This method is working well in all browsers except IE7 and I assume earlier (IE8 works well). I have traced the problem to the fact IE7 postsback the contents of the button element as opposed to the value. This means the span tag is being returned causing ASP.NET to throw an:
[HttpRequestValidationException (0x80004005): A potentially dangerous Request.Form value was detected from the client (Button1="<SPAN>Button</SPAN>").]
Which is correct behaviour. I realise I can disable this behaviour using the Page.ValidateRequest property however as this is an existing application, this will result in major changes on every page to manually protect the application from Cross Site Scripting attacks.
Is anyone aware of a way I could make this work for IE7 and earlier?
Any ideas would be appreciated.
Thanks in advance.