Thursday, January 21, 2010

ScriptManager.RegisterClientScriptBlock doesn't work in Render(HtmlTextWriter writer)

I tried to put a client script for a rediredtion in a page with a Update panel in that page.

First I tried with Response.Write - didn't work but I had an error
I tried with ClientScript.RegisterStartupScript - didn't work, no error
I tried with ScriptManager.RegisterClientScriptBlock in the event :
protected override void Render(HtmlTextWriter writer) - didn't work, not error

Finaly it worked in the button click with ScriptManager.RegisterClientScriptBlock

I think the ideea is to put the client script in an event related to an object from the update panel. If not it can't be write on the client script - which is kind of logic.

No comments:

Post a Comment