locked
Accessing Javascript from C# RRS feed

  • Question

  • Dear group,

    please help

    I have the following c# code to access some Javascipt in a separate file ( I
    am practically teaching myself):

    if (!ClientScript.IsStartupScriptRegistered(this.GetType(), "sw_geocode"))

    try

    {

    ClientScript.RegisterStartupScript(this.GetType(), "sw_geocode", "<script
    language='javascript' src='sw_geocode.js'></script>");

    ClientScript.RegisterStartupScript(this.GetType(), "sw_geocode", "<script
    language='javascript' src='sw_geocode.js'>getaddress</script>");



    A number of sources say that this method has become deprecated but can still
    be used.

    Firstly, is the above syntax correct to access the script and function or
    can aspects in other parts of my code affect the method that I have used?

    Secondly, how do you then call the function?

    Thirdly, does anyone know of good resource material (e.g. web or books) for
    advice on issues like this?

    Forthly, does anyone live nearby to Cambridge UK who I can contact, visit or
    be visited by for occasional advice on issues like this?

    Best regards

    Steve W







    • Moved by Leo Liu - MSFT Tuesday, April 24, 2012 7:13 AM Off-Topic (From:Visual C# Express Edition)
    Tuesday, April 17, 2012 8:45 AM

Answers

  • Hi Steve,

    For ASP.NET development problems you need to post in the dedicated ASP.NET Forum for specialized support.
    Thanks for your understanding and have a nice day,

    Leo Liu [MSFT]
    MSDN Community Support | Feedback to us

    • Proposed as answer by Kevin.kalou Friday, April 20, 2012 8:54 AM
    • Marked as answer by Mr. Wharty Thursday, May 31, 2012 6:25 AM
    Friday, April 20, 2012 8:28 AM