Solved

Partial postback to stop screen flickr in MVC view

Posted on 2010-09-07
6
1,080 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 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
Save on storage to protect fatherhood memories

You're the dad who has everything. This Father's Day, make sure your family memories are protected. My Passport Ultra has automatic backup and password protection to keep your cherished photos and videos safe. With up to 3TB, you have plenty of room to hold the adventures ahead.

 

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

Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now