ScriptManager.RegisterStartupScript中传递参数 [英] passing parameter in ScriptManager.RegisterStartupScript
本文介绍了ScriptManager.RegisterStartupScript中传递参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
string v1="nitin";
string javaScript ="window.open('Default2.aspx?p1='"+v1+",'','width=400, height=400, left=300, top=400');";
ScriptManager.RegisterStartupScript(this, this.GetType(), "hi", javaScript.ToString(), true);
如果我们不传递参数,它将很好用,但是对于一个或多个参数,它将不起作用
if we dont pass parameter it works fine,but for one or more parameters it doesnt work
推荐答案
您可以直接为第一个参数提及页面/控件名称. br/>
检查此链接[ ^ ]希望这会有所帮助.
You can mention the page/control name directly for the first parameter.
check this link [^] hope this helps.
对我来说很好
看这个
it works fine for me
look at this
string pageurl = "ViewBlogs.aspx?blogid=" + e.CommandArgument.ToString() + "&action=view";
string script = "<script language='javascript'>viewblogs('" + pageurl + "');</script>";
ScriptManager.RegisterStartupScript(Page, typeof(string), "clientScript", script, false);
这篇关于ScriptManager.RegisterStartupScript中传递参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文