Results 1 to 3 of 3

Thread: VB.net 2005 to 2008 Client Script Issue

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2012
    Posts
    2

    VB.net 2005 to 2008 Client Script Issue

    Need some help on solving a issue with ClientScript.RegisterClientScriptBlock.

    Hopefully somebody has seen this before.

    I am getting a error that states that TypeLoadException was unhandled by user code.

    Could not Load type 'Javascript' from assembly 'App_Code.ti5_zjxv, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

    Heres the code:
    Page.ClientScript.RegisterClientScriptBlock(Type.GetType("Javascript", True, True), "ShowPopupMenu", sJS)

    oPage.ClientScript.RegisterClientScriptBlock(Type.GetType("Javascript", True, True), "NavigateTo", sJS)


    This javascript is for navigate and show popupmeun.

  2. #2
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Re: VB.net 2005 to 2008 Client Script Issue

    Hi and welcome to VBF!

    This is because there is no JavaScript type which is why you are getting the TypeLoadException.

    GetType with a string parameter would be used as follows
    Code:
    Type.GetType("System.Int32"); //Where System.Int32 is a valid type
    Commonly people use
    Code:
    Page.ClientScript.RegisterClientScriptBlock(Me.[GetType](), "ShowPopupMenu", sJS)

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2012
    Posts
    2

    Re: VB.net 2005 to 2008 Client Script Issue

    I fix that first issue not I have this one. Any ideas?

    Compilation Error
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: BC30469: Reference to a non-shared member requires an object reference.

    Source Error:



    Line 217:
    Line 218: Public Shared Sub AddJavascript(ByVal oPage As Page)
    Line 219: Javascript.AddShowPopupMenu(oPage)
    Line 220: Javascript.AddNavigateTo(oPage)
    Line 221: End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width