Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Partial postback to stop screen flickr in MVC view

Posted on 2010-09-07
6
Medium Priority
?
1,131 Views
Last Modified: 2013-12-17
I have an mvc view that is made up like wizard navigation.  So view is loaded and when "next button" clicked new data is loaded into view.   I want to stop page flickr so new data is loaded without flickr.  What is best approach.

I am using the same view all the time it is just the data that changes.  So on click of next button I call actionresult post method and return same view with different data.

So I need to know how to stop flickr on view
0
Comment
Question by:ToString1
  • 3
  • 3
6 Comments
 
LVL 19

Expert Comment

by:Bardobrave
ID: 33616979
Maybe you can use AJAX calls to load your server data, they usually are flawless from client point of view and avoid any flicking in the screen.
0
 

Author Comment

by:ToString1
ID: 33617353
I would need an example please
0
 
LVL 19

Accepted Solution

by:
Bardobrave earned 2000 total points
ID: 33617405
Ok, lets see...

Supose you have a {controller} which has a {method} that return you the code of a new page of your wizard. Now you're calling your host/controller/method through a postback on a form sit on your form, and this is making your page flicks while data cames from server.

If you use jquery you can substitute your view's form for a button of any type (I usually use links or css styled divs as buttons) and from your client code (on javascript file) use something like that:

/*---- other js code in your page---*/

$("#yourButtonId").click(function () {
   $.post($.url("host/controller/method"),function (htmlResponse) {
     $("#yourDIVContainerId").html(htmlResponse);
   })
});;

/*---- rest of your client code----*/

Here htmlResponse will get the html code that your host/controller/method returns and embed inside your container (I'm assuming here you use a div, but it would be the same whatever your container is).

If you don't use jquery the calls are a bit more complex, as you will need to create an XMLHttpObject and make the call and success callback directly through it's methods.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ToString1
ID: 33617790
ok thanks

Currently my actionresult signature is like this

public ActionResult SubmitThis(int ID, List<FOO> Foos)
{
}

So what would I need to do ?
0
 
LVL 19

Assisted Solution

by:Bardobrave
Bardobrave earned 2000 total points
ID: 33618476
SubmitThis is your "method", and it would be inside a "controller", the problem you'll find is that you pass to your method a complex structure like List<FOO>, here you have two options:

1) You can simplify your method to receive something you can pass it through client code.

2) You can call through AJAX to a different method who builds your ID and Foos variables and calls back to SubmitThis.
0
 

Author Comment

by:ToString1
ID: 33631957
Thanks for your comments;  I will look into these and award points tomorrow
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question