all groups > asp.net building controls > february 2005 >
You're in the

asp.net building controls

group:

Changing HTML in the Render() method



Re: Changing HTML in the Render() method Wilco Bauwer
2/19/2005 1:07:01 PM
asp.net building controls: You could either use filters to modify the output (which is very
"low-level"), or you could override the implementation of a
LinkButton's control, which I would probably recommend. I say probably,
because I do not know exactly what you want to achieve. What should the
resulting href be?
Changing HTML in the Render() method Benton
2/19/2005 1:10:28 PM
Hi there,

I am looking for C# code samples on how to:

1.- Get a string with the default HTML that would be rendered for a custom
control.
2.- Customize this string.
3.- Make the control render the customized HTML.

I want to customize the "HREF" part of the HTML generated for a LinkButton.
I am new to custom control writing and if this is possible it would be done
in the Render method, right?

Many thanks in advance,

-Benton

Re: Changing HTML in the Render() method Benton
2/19/2005 3:27:04 PM
[quoted text, click to view]

I am working on a custom control inherited from the LinkButton class. A
snippet of the default HTML output for the control looks like this:

<a href="javascript:__doPostBack('ctl00$cphHolder$lnkAgregar','')">

I want to add additional content and make it look like this:

<a href="javascript:__doPostBack('ctl00$cphHolder$lnkAgregar','')
onMouseover="window.status='Hi there!'; return true"
onMouseout="window.status=' '; return true;">

Thanks for any ideas,

-Benton

Re: Changing HTML in the Render() method Wilco Bauwer
2/19/2005 3:59:25 PM
Why not do something like:
<asp:LinkButton ... onmouseover="window.status=...." />

Or programmatically:
myLinkButton.Attributes["onmouseover"] = "window.status....";
AddThis Social Bookmark Button