Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Am working with jquerey getting the error

Microsoft JScript runtime error: Object doesn't support this property or method

when I remove jquerey Ui reference it's showing error like object expected

I have tried all the ways through google but it's not working

I am trying to show a popup dialog Calling Showmessage function from code behind using Page.ClientScript.RegisterStartupScript




my code follows here :


code behind :

C#
Page.ClientScript.RegisterStartupScript(Me.GetType(), "MyScript", _
                   "javascript:showMessage();", True)







JavaScript
<link rel="shortcut icon" href="images/favicon.ico" />
    <link rel="icon" type="image/gif" href="images/tnt_icon.gif" /> 
    <link href="css/CommonStyles.css" rel="stylesheet" type="text/css" />  
    
    <link type="text/css" href="css/ui-lightness/jquery-ui-1.8.21.custom.css" rel="stylesheet" />
    <%--
	<script src="js/jquery-1.7.2.min.js" type="text/javascript" ></script>
	<script src="js/jquery-ui-1.8.21.custom.min.js" type="text/javascript" ></script>	
	<script src="js/jquery.uniform.js" type="text/javascript" ></script>	--%>

    <script src="js/jquery-1.4.4.min.js" type="text/javascript"></script>
	<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript" ></script>	

	<script type="text/javascript">
	
	     var jq = $.noConflict(true);

------> error here	    function showMessage()
        {
            jq('#Popup').dialog(
                {              
                    title: "Login | Failure",
                    position:['center',150],
                    modal: true,
                    resizable: false,
                    width: 650,
                    buttons: [
                    {
                        id: "button-ok",
                        text: "Ok",
                        click: function() 
                        { 
                            $(this).dialog("close");                         
                        }
                    }
                ] 
            });
            jq("#Popup").dialog("option", "buttons", null);
            //$('#Popup').parent().appendTo($("form:first"));
        }
    
        function closeDialog()
        {
             jq('#Popup').dialog('close');          
        }
   
	</script>
	
	<script type="text/javascript">
	<!--
	    function showThankYouMessage()
        {
            $('#PopupThankYou').dialog(
                {              
                    title: "Boomerange | Thank You",
                    position:['center',150],
                    modal: true,
                    resizable: false,
                    width: 600,
                    buttons: [
                    {
                        id: "button-ok",
                        text: "Ok",
                        click: function() 
                        { 
                            $(this).dialog("close");                         
                        }
                    }
                ] 
            });
            $("#PopupThankYou").dialog("option", "buttons", null);             
        }
    
        function closePopupThankYou()
        {
             $('#PopupThankYou').dialog('close');          
        }
    -->
	</script>


any help would be appreciated

Thanks in advance
Pradeep Anugu
Posted
Comments
AmitGajjar 21-Mar-13 9:21am    
Where you have write code to register javascript ? is that on page load or page init ?
Pradeepp Anugu 21-Mar-13 9:27am    
not in page load in button click event
AmitGajjar 21-Mar-13 9:29am    
try to place javascript after all your code. this can be because javascript call before object creation.
Pradeepp Anugu 21-Mar-13 9:32am    
thanks for ur reply


Protected Sub BoomerangLoginForm_LoginError(ByVal sender As Object, ByVal e As System.EventArgs) Handles BoomerangLoginForm.LoginError
If Not String.IsNullOrEmpty(BoomerangLoginForm.UserName.Trim()) Then
Dim oWebUser As MembershipUser = Membership.GetUser(BoomerangLoginForm.UserName.Trim())
If oWebUser IsNot Nothing Then
'if user exist
If Membership.GetUser(DirectCast(BoomerangLoginForm.FindControl("UserName"), TextBox).Text.Trim()).IsLockedOut Then
BoomerangLoginForm.FailureText = ""
Dim _alertString As String = "Sorry! Your attempt to log in is automatically denied as you have thrice entered an incorrect passowrd. Please click " & _
"" & _
"Forgotten your password
" & _
" to request a new password to enable you to access the secured pages of the website."
lblMessage.Text = _alertString
Page.ClientScript.RegisterStartupScript(Me.GetType(), "MyScript", _
"javascript:showMessage();", True)

------- > this is from where am calling java script function 'ScriptManager.RegisterClientScriptBlock(Page, Me.GetType(), "MyScript", _
' "javascript:showMessage();", True)


Else
BoomerangLoginForm.FailureText = "Invalid login id or password."
End If
Else
'if user does not exist
'LoginForm.FailureText = "Login ID does not exist."
BoomerangLoginForm.FailureText = "Invalid login id or password."
End If
End If

End Sub
AmitGajjar 21-Mar-13 9:34am    
ok, but try to place your script tag and script files after your aspx page completed. and check the result.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900