Groups | Blog | Home
all groups > asp.net webcontrols > october 2004 >

asp.net webcontrols : Remove language attribute from HtmlInputButton


Jonas
10/21/2004 11:15:40 AM
Hi!

I'm working with an ASP.NET web site that needs to conform with XHTML 1.0
Transitional and got an ASP.NET HtmlInputButton which automatically adds the
attribute language="javascript" which isn't allowed in XHTML. I've tried to
remove this attribute by executing

QuickSearchButton.Attributes["language"] = ""; or
QuickSearchButton.Attributes["language"] = null; or
QuickSearchButton.Attributes.Remove("language");

in either Page_Load or QuickSearchButton_PreRender, but it does not work. I
can add a new custom attribute, so I know that I can access the control.

I found some postings about using a filter when outputting the response
stream, but that seems to be overkill for just this issue. Before I start
hacking away, I have some questions:

1. Is it possible to build the control entirely from code-behind without
a language attribute ?

2. Could I perhaps use .RenderControl and filter the output there?

3. Is there any other way to accomplish this?

Brgds

Jonas

Ken Cox [Microsoft MVP]
10/22/2004 1:33:04 PM
Hi Jonas,

You might want to investigate this control to see if it ensures your output
is valid:

XHTML 1.0 Strict Filter

http://www.asp.net/ControlGallery/ControlDetail.aspx?Control=2266&tabindex=2

[quoted text, click to view]
Ken Cox [Microsoft MVP]
10/22/2004 1:35:07 PM
Oops. Just realized that you had considered that option but found it overkill.


[quoted text, click to view]
Jonas
10/25/2004 10:48:08 AM
Hi and thanks for your answer.

Yes, I found the filter but would rather not use that as I feel a bit
uncomfortable with adding an extra layer of execution to all output just to
get rid of the language attribute. I guess I'll have to rewrite the page so
that it not uses the ASP.NET control.

Brgds

Jonas

[quoted text, click to view]

AddThis Social Bookmark Button