I worked it out.
By overiding Render, calling base.Render(output) and then adding to
the HTML output stream i can run a script after the control had been
rendered. Previously i could only run a script before it was rendered
and that meant the control didn't exist yet.
//In custom control (which is a composite control)
protected override void Render(HtmlTextWriter output)
{
//add HTML components to the output stream
base.Render(output);
StringWriter s = new StringWriter();s.WriteLine("
<script language='JavaScript'>
doent.getElementById('MyControl').style.cursor = 'newCursor.cur';
</script>");
output.WriteLine(s.ToString());
}
[email]geoffrey.daviscsiro.au[/email] (Geoff Davis) wrote in message news:<6dfb2422.0401122159.41c4816fposting.google. com>...> Is there any way to create a web control that calls a client side
> onLoad function?
>
> Its diffucilt since you are not able to access the form or body tags
> in the control.
>
> I inherit from:
> System.Web.UI.WebControls.WebControl
>
> What I'm really trying to do is set a cursor, i haven't been able to
> set it server side only in JavaScript.
>
> Any help would be great.
Bookmarks