How do I pass a server control's actual client Id to a javascript function?

前端 未结 6 615
鱼传尺愫
鱼传尺愫 2020-12-19 07:00

I have the following textbox server control in my web page:



        
6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-19 07:13

    I solved the same problem with an

    When using <%= TargetControl.ClientID %> (without single quotes surrounding), ASP.NET renders '<%= TargetControl.ClientID %>' and the associated javascript function isn´t called.

    When using '<%= TargetControl.ClientID %>' (with sigle quotes surrounding), ASP.NET don´t evaluates the expression and renders exactly the same inside the single quotes.

    So I decide to try with an Input(Checkbox) HTLM control instead, using the following markup

    
    

    and it worked!!!

    Hope it helps.

提交回复
热议问题