locked
How to make 'id' to "id" in Code-Behind (Problem Resolved by using "") RRS feed

  • Question

  • User944339287 posted

    Hi guys.. this is the original javascript

                d = `[{
                        "id": "1",
                        "ttl": "About Us",
                        "link": "/page/about-us/"
                    },{
                        "id": "2",
                        "ttl": "Contact Us",
                        "link": "/contact-us/"
                    }]`,
                obj = JSON.parse(d);

    and now i trying to generate it from code-behind but failed. it's because of i can't change 'id' to "id" in codehind. Any idea?

            Me.litScript.Text = "d = `[{" & _
            "'id': '1'," & _
            "'ttl': 'About Us'," & _
            "'link': '/page/about-us/'" & _
                    "},{" & _
            "'id': '2'," & _
            "'ttl': 'Contact Us'," & _
            "'link': '/contact-us/'" & _
                    "}]`," & _
                "obj = JSON.parse(d);"




    Friday, May 7, 2021 6:00 AM

All replies

  • User-1545767719 posted

    Consider using the ClientScriptManager to register client script by code behind.

    Friday, May 7, 2021 10:02 PM