How to make a simple yes/no popup in ASP.NET that return the result back to my c#?

前端 未结 7 978
再見小時候
再見小時候 2020-12-21 01:05

With ASP.NET, how do I prompt the user for a yes/no question and getting the result back to my .ascx?

So far I can open a confirmation dialog with use of Javascript,

7条回答
  •  囚心锁ツ
    2020-12-21 01:26

    You need to use ajax, or to make a postback to the server. Your c# code is server side and the javascript is client side. If you use the ajax extensions for asp .net you can use javascript page methods:

    PageMethods.YourMethod(confirm('your text'), OnSuccess, OnFailure);
    

提交回复
热议问题