最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

asp.net: c#javascript user needs to confirm before submitting - Stack Overflow

programmeradmin4浏览0评论

i have a webform on asp c# page

the user enters data into the form. there are textboxes and there's a treeview

when the user presses the SUBMIT button, i would like all the data to be shown to him for his confirmation. the user should have the option to continue with the submit OR to go back to the form and edit the data.

is there an all ready out of the box way to do this>? if not, what is the easiest way to implement this?

i have a webform on asp c# page

the user enters data into the form. there are textboxes and there's a treeview

when the user presses the SUBMIT button, i would like all the data to be shown to him for his confirmation. the user should have the option to continue with the submit OR to go back to the form and edit the data.

is there an all ready out of the box way to do this>? if not, what is the easiest way to implement this?

Share Improve this question asked Oct 23, 2011 at 3:31 baiapoopedbaiapooped 1854 silver badges13 bronze badges 1
  • have you found any answer for this? – Thariq Nugrohotomo Commented Jun 26, 2014 at 7:14
Add a ment  | 

2 Answers 2

Reset to default 16

If it's a button web control, you can add onClientClick and a confirm javascript call.

<asp:button Id="btnSubmit" Text="Submit" 
       onClientClick=" return confirm('Are you sure?')" 
       onClick="btnSubmit_click" />

You can use a simple button and call a function which if your condition == true send your data or submit data using ajax

 <input type="button" onclick="TestBeforeSubmit();"value="">
    
    
    function TestBeforeSubmit()
           {
               if //Conditions == false)
               {
                   
               }
               else
               {
                   $.ajax({
                       type: "POST",
                       url: "//YourUrl",
                       dataType: 'json',
                       data: //YourData,
                       success: function (result)
                       {
                       },
                       error: function (result) {
                           alert("Something went wrong");
                       },
                   });
    }
发布评论

评论列表(0)

  1. 暂无评论