This is a migrated thread and some comments may be shown as answers.

Error with Custom Control

2 Answers 209 Views
ScriptManager and StyleSheetManager
This is a migrated thread and some comments may be shown as answers.
Sonny Chouinard
Top achievements
Rank 1
Sonny Chouinard asked on 29 Oct 2009, 06:03 PM
I Get a javascript error when I put the following control in the same page as a ScriptManager.

If i remove the
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        </telerik:RadScriptManager> 
tag, no error happen.
What can i do to solve this?

Javascript Error
Webpage error details 
 
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.0.3705) 
Timestamp: Thu, 29 Oct 2009 19:03:10 UTC 
 
 
Message: Object doesn't support this property or method 
Line: 15 
Char: 27336 
Code: 0 
URI: http://localhost/WebRequest40/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ScriptManager1_HiddenField&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d3.5.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3afr-CA%3a0d787d5c-3903-4814-ad72-296cea810318%3a52817a7d%3a67c678a8%3bTelerik.Web.UI%2c+Version%3d2008.3.1125.35%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3afr-CA%3afd794f69-50b6-4e80-a52c-60fb1a05429c%3a393f5085%3aa8595f70%3a9efc6f46%3a4b6f7e66%3a80ec1d93%3ae9e0cae%3ac6335cbd%3a414de951%3a6dd34527%3a526d426%3a80c4ad6d%3a527acb41%3a6f2bcae9%3a34f9d57d 
 
 


Telerik Version=2008.3.1125.35

Custom control
Imports System.ComponentModel 
Imports System.Web.UI 
Imports Telerik.Web.UI 
Public Class ValidatingTextbox 
    Inherits Textbox 
    Implements IPostBackEventHandler 
 
 
 
    Public Delegate Sub OnBlurDelegate(ByVal sender As ObjectByVal e As EventArgs) 
    Public Event Blur As OnBlurDelegate 
 
 
    Protected Overrides Sub OnInit(ByVal e As System.EventArgs) 
        MyBase.OnInit(e) 
        If Not Page.ClientScript.IsClientScriptBlockRegistered("OnBlurTextBoxEvent"Then 
            Page.ClientScript.RegisterStartupScript(MyBase.GetType"OnBlurTextBoxEvent", GetScript, True
            Attributes.Add("onblur""OnBlurred(" & UniqueID & ",'')"
        End If 
    End Sub 
 
 
 
    Protected Sub OnBlur() 
        RaiseEvent Blur(Me, EventArgs.Empty) 
    End Sub 
 
    Private Function GetScript() As String 
        Return "function OnBlurred(control, arg)" & vbCrLf & _ 
                "{" & vbCrLf & _ 
                "    __doPostBack(control, arg);" & vbCrLf & _ 
                "}" 
    End Function 
 
    Public Sub RaisePostBackEvent(ByVal eventArgument As StringImplements System.Web.UI.IPostBackEventHandler.RaisePostBackEvent 
        OnBlur() 
    End Sub 
 
End Class 
 

The page looks like this:
</head> 
<body> 
    <form id="form1" runat="server"
    <div> 
        <br /> 
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        </telerik:RadScriptManager> 
         <cc1:ValidatingTextbox CssClass="input" ID="txtRecordTest2" Style="left: 200px; position: absolute;" 
                                TabIndex="5" runat="server" Width="141px" AutoPostBack="True"/> 
        <br /> 
    </div> 
    </form> 
</body> 
</html> 
the code behind
Partial Public Class test
    Inherits System.Web.UI.Page 
 
    Private Sub txtRecordTest2_Blur(ByVal sender As ObjectByVal e As System.EventArgs) Handles txtRecordTest2.Blur 
        'Some thing is done 
    End Sub 
End Class 

2 Answers, 1 is accepted

Sort by
0
Sonny Chouinard
Top achievements
Rank 1
answered on 29 Oct 2009, 07:37 PM
I joined a picture of the javascript error in debug mode.
0
Veselin Vasilev
Telerik team
answered on 03 Nov 2009, 01:36 PM
Hello Jonathan GrandMaison,

It seems that the problem is in the MIcrosoftAjax.js
What happens if you replace RadScriptManager with the asp:ScriptManager? I suppose you will get the same error.

Kind regards,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ScriptManager and StyleSheetManager
Asked by
Sonny Chouinard
Top achievements
Rank 1
Answers by
Sonny Chouinard
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Share this question
or