使用ShowModalDialog使用来自asp.net Code后面的查询字符串传递值

时间:2012-07-11 07:38:32

标签: javascript asp.net

我正在从ASP.Net Code打开一个javascript ShowModalDialog,代码如下所示: -

string _timeSpentinMin="123"; Page page = HttpContext.Current.CurrentHandler as Page; ScriptManager.RegisterStartupScript(page, page.GetType(), "OpenModalDialog", "<script type=text/javascript>window.showModalDialog('ClockPopUP.aspx', null, 'dialogWidth:290px;dialogHeight:270px;status:no'); </script>", false);

我还想将一个查询字符串传递给Clock.aspx,并从javascript中我这样做: -

function openmodalWinLunch() {
            var variable1 = "Lunch";
            window.showModalDialog("ClockPopUP.aspx?code=" + variable1, "dialogWidth:290px;dialogHeight:270px,");
        }

我的问题是我们将如何从后面的asp代码中做同样的事情。请按照上面提到的更新我的ASp.Net代码以满足我的需求。我想使用showmodalDialog将字符串变量_timespentinMin从查询字符串传递到Clock.aspx页面。

1 个答案:

答案 0 :(得分:0)

Session["TaskActiveNonProd"] = isAnyNonProdTaskActive;
Page page = HttpContext.Current.CurrentHandler as Page;
ScriptManager.RegisterStartupScript(page, page.GetType(), "OpenModalDialog", "<script type=text/javascript>window.showModalDialog('ElapsedClockNonProd.aspx?code=" + isAnyNonProdTaskActive.ToString() + "', null, 'dialogWidth:290px;dialogHeight:270px;status:no'); </script>", false);