Reputation: 185
i have a webform on asp.net 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?
Upvotes: 6
Views: 7417
Reputation: 1
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");
},
});
}
Upvotes: 0
Reputation: 108937
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" />
Upvotes: 16