Solved

Partial postback to stop screen flickr in MVC view

Posted on 2010-09-07
6
1,078 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
Comment Utility
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
Comment Utility
I would need an example please
0
 
LVL 19

Accepted Solution

by:
Bardobrave earned 500 total points
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:ToString1
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks for your comments;  I will look into these and award points tomorrow
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 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

15 Experts available now in Live!

Get 1:1 Help Now