1
<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. but it is not working.
My javascript function is

function openWinContentTemplate() {
    $find("RadWindow_ContentTemplate").show();
}

This opens a radwindow if the condition is satisfied.
Its not working could anyone plz help me out.

4
  • So when the page loads have you checked to see if this function openWinContentTemplate(); has been spit out? (view source) Commented Nov 12, 2011 at 6:28
  • Is the btn_create button placed in an UpdatePanel? Commented Nov 12, 2011 at 6:31
  • are you inside an updatepanel? and could you show your markup also? Commented Nov 12, 2011 at 6:35
  • Ya its working well on page load but I want to make it work from code behind under the if condition.How can I do that? Commented Nov 12, 2011 at 16:29

1 Answer 1

0

I would suggest using AJAX to call the method and make the method return something meaningful. If all you want to do is show an element, make the method return a boolean.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.