Click here to Skip to main content
14,739,344 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi experts
I'm new in MVC I want to do my postback in background but It posts all the page. (An unwanted showing page progress bar)

@using (Ajax.BeginForm("Index", "ContactUs", new AjaxOptions { HttpMethod = "POST" }, new { id = "contactUsForm" }))
{
   @Html.TextBoxFor(@m => m.Name, new { id = "name"})
   <input type="submit" value="Send"  />
}


When I click on submit It posts all the page and also the browser's progress bar appears undesirably!
but:
I want to post in background.
What else may I do to achieve my goal?

Thanks
Posted
Updated 14-Oct-14 7:44am
v3
Comments
Ranjeet Patel 15-Oct-14 7:28am
   
See if you write [HtppPost] on the top of the action method

1 solution

If you want to have the progress to be shown on the Browser's page, then you can use ajax call and leave the Action and controller blank.
$("#SUBMIT BUTTON ID").click(function(){
$("#YOUR PROGRESS DIV ID").show();
$.ajax({
type:"POST",
url:"Ur URL",
success: fuction(){
$("#YOUR PROGRESS DIV ID").hide();
}
});
});

An ajax call is by default asynchronous. So this might solve your work.
Please post back you queries in comments if any.
Thanks
:)
   
Comments
mariazingzing 14-Oct-14 12:42pm
   
Thanks, but I think You have a misunderstanding about my problem, sorry!
My problem is: It does show progressbar in my browser, I want to prevent to show it.
I used "Ajax.BeginForm" but it doesn't work on background at all :(
[no name] 14-Oct-14 12:58pm
   
If ajax is used the Submit should work out on the background only. Where is actually the progress bar!! Have you placed that!!
mariazingzing 14-Oct-14 14:12pm
   
No, the progressbar is for the browser. IE or FireFox. I mean the progressbar that is placed in IE statusbar.
It updates _layout and all the page but I want to update only the AjaxForm. Not more.
[no name] 14-Oct-14 14:22pm
   
ok does this post methos return a view??please check that!!
mariazingzing 14-Oct-14 15:09pm
   
yes, AjaxView but If it posts "view" it also won't work
[no name] 14-Oct-14 23:02pm
   
Ok the action method of submit, allow it to perform the action but return nothing. Return null and check once.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900