How to get the response from Confirm box in the code behind

前端 未结 5 708
一向
一向 2021-01-19 05:20

I am new to asp.net/C# .I am trying to create a web application.

Below is my requirement.

I am trying to save a record on button click. Before saving the rec

5条回答
  •  孤独总比滥情好
    2021-01-19 05:59

    You can use confirm box in JS like this

    var ans = confirm ('Record already exist.Do you want to proceed?');
    if(ans==true)
    {
    }
    else
    {
    }
    

    Secondly, to get the response in code behind, you can store the Yes/No value into a hidden field e.g.

    document.getElementById('<%= hiddenField.ClientID %>').value = ans;
    

提交回复
热议问题