在前面加上this.Parent.Page.就可以了,如下 this.Parent.Page.ClientScript.RegisterStartupScript(this.GetType(), "abc", "Panel()");