How to call javascript function from c#

前端 未结 7 1547
盖世英雄少女心
盖世英雄少女心 2020-12-11 19:18

I like to call a JavaScript function from c#. Can any one can give me code snippet.

More detail...

I have a asp.net page which has a asp button. when i click

7条回答
  •  粉色の甜心
    2020-12-11 20:10

    i tried with this code it works for me check whether it helps

    1)

    Page.ClientScript.RegisterStartupScript(this.GetType(), "click", "alert('Informations');", true); 
    

    The other way is call the javascript method which is written in source page

    Page.ClientScript.RegisterStartupScript(this.GetType(), "click", "xyz();", true); 
    

提交回复
热议问题