从code后面的JavaScript调用

问题描述:

我有一个C#asp.net 3.5应用程序
我试图打开从code窗口的特定事件后落后。我有这个,但它不工作,有萤火中没有错误

I have a c# asp.net 3.5 app I am trying to open a window from code behind after a certain event. I have this but its not working and there are no errors in firebug

protected override void OnPreRender(EventArgs e) {
            base.OnPreRender(e);
            if (openCredentialsWindow) {
                if (openCredentialsWindow_ClientId != Guid.Empty) {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "openCredentials", string.Format("radopen('Services.aspx?clientId={0}, Window_Services')", openCredentialsWindow_ClientId.ToString()));
                }
            }
        }

任何想法?

假设pre-条件为真。你需要一个额外的参数传递给 RegisterClientStartupScript 方法调用,以表明scriptTags需要添加。

Assuming that the pre-conditions are true. You need to pass an additional parameter to the RegisterClientStartupScript method call to indicate that scriptTags need to be added.

Page.ClientScript.RegisterStartupScript(this.GetType(), "openCredentials", string.Format("radopen('Services.aspx?clientId={0}, Window_Services')", openCredentialsWindow_ClientId.ToString()),true);