Can’t get ScriptManager.RegisterStartupScript in WebControl nested in UpdatePanel to work

I had an issue using this in a user control (in a page this worked fine); the Button1 is inside an updatepanel, and the scriptmanager is on the usercontrol. protected void Button1_Click(object sender, EventArgs e) { string scriptstring = “alert(‘Welcome’);”; ScriptManager.RegisterStartupScript(this, this.GetType(), “alertscript”, scriptstring, true); } Now it seems you have to be careful with … Read more

RegisterStartupScript doesn’t work with ScriptManager,Updatepanel. Why is that?

When you use an UpdatePanel, then you can not call JavaScript using ClientScript as you have tried to. You have to use ScriptManager.RegisterStartupScript instead. So change your Page.ClientScript.RegisterStartupScript(this.GetType(), “myKey”, javaScript); to ScriptManager.RegisterStartupScript(updatePanelId,updatePanelId.GetType(), “alert”, javaScript, true);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)