Question

I'm trying to write java script at runtime in which i have to find the radiobuttonlist at runtime but i have to pass it name in string datatype

 Dim scriptText As String = ""
        scriptText &= "function DisplayCharCount(){

        scriptText &= " console.log(document.getElementById(**RadioButtonList1**));"

        scriptText &= "}"
        ClientScript.RegisterClientScriptBlock(Me.GetType(), _
            "CounterScript", scriptText, True)

RadioButtonList1 should be enter in from string like "RadioButtonList1" so how i m suppose to do that?

Was it helpful?

Solution

Just use double "" or '

        Dim scriptText As String = ""
        scriptText &= "function DisplayCharCount(){"

        scriptText &= " console.log(document.getElementById('RadioButtonList1'));"

        scriptText &= "}"
        ClientScript.RegisterClientScriptBlock(Me.GetType(), _
            "CounterScript", scriptText, True)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top