Solved

Partial postback to stop screen flickr in MVC view

Posted on 2010-09-07
6
1,110 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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
Independent Software Vendors: 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 500 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Recently I spent hours debugging an issue in a Rails project where ActiveRecord was causing MySQL errors trying to create a User object of a class at the top level of a Single Table Inheritance model structure.  It turns out `.create` behaves differ…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

617 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