How to call javascript method in asp.net web application

前端 未结 4 1358
无人及你
无人及你 2021-01-21 01:26

I want to use a javascript function inside a c# function

protected void button1_Click(object sender,EventArgs e){
    //javascript function call ex.
    /*
    b         


        
4条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-21 02:00

    You're mixing two different technologies. C# runs on the server. It renders an HTML page (which may include Javascript). This page is then sent to a client's browser, where Javascript finally gets executed.

    In Javascript you can prompt user about record deletion or whatever, and then you have to either navigate to another page or use AJAX to send result to the server.

    I suggest that you get a good ASP.NET book. It will clear many uncertainties for you.

提交回复
热议问题