[英]using javascript function to be called from code behind under specific condition
<asp:Button ID="btn_create" runat="server"
Text="Create Weekly Report"
OnClick="btn_create_Click" />
This is a user button and code behind is 这是一个用户按钮,后面的代码是
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
if (!(dr.HasRows))
{
Page.ClientScript.RegisterStartupScript(
this.GetType(),
"alert",
"openWinContentTemplate();",
true);
}
else
{
Response.Redirect("entry.aspx");
}
con.Close();
I want to call the javascript functionif the first condition is true. 如果第一个条件为真,我想调用javascript函数。 but it is not working.
但它不起作用。
My javascript function is 我的JavaScript函数是
function openWinContentTemplate() {
$find("RadWindow_ContentTemplate").show();
}
This opens a radwindow if the condition is satisfied. 如果满足条件,将打开一个窗口。
Its not working could anyone plz help me out. 它无法正常工作,任何人都可以帮助我。
I would suggest using AJAX to call the method and make the method return something meaningful. 我建议使用AJAX来调用该方法并使该方法返回有意义的东西。 If all you want to do is show an element, make the method return a boolean.
如果您只想显示一个元素,则使该方法返回一个布尔值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.