0

VB.Net:

Protected Sub btnFinish_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnFinish.Click

            For a As Integer = 0 To grdQ.Rows.Count - 1 Step a + 1
                Dim an As TextBox = DirectCast(Me.grdQ.Rows(a).FindControl("txtAnswer"), TextBox)
                If an.Text = String.Empty Then
                    'do something
                    Exit For
                ElseIf an.Text <> "" Then
                    ScriptManager.RegisterClientScriptBlock(Page, Me.GetType(), "Script", "finAns();", True)
                End If
            Next
        End Sub

..JavaScript:

<script type='text/javascript'>
   function finAns() {
    $("#timeLeft").dialog({
                title: "There's Still Time Left!",
                open: function(event, ui) { $(".ui-dialog-titlebar-close").hide();
                                          },
                modal: true,
                draggable: false,
                resizable: false 
    });
       return false;
  }
</script>

What's wrong with these codes? It seems like it's not working. Calling the javascript function is not working.. I'm not so good with javascript that's why I need some help. Thanks :D

2
  • Any errors in console? Commented Dec 9, 2013 at 5:40
  • Nothing. It just not fire the calling of JavaScript function. Commented Dec 9, 2013 at 5:42

1 Answer 1

1

Try

Page.ClientScript.RegisterStartupScript(this.GetType(),"CallMyFunction","finAns()",true)
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.