Page is Postback

May 4, 2011 at 7:00 PM

Thanks for this project!
It's really wonderful project!

However, when i am on Dashboard with layout, everything is work well, then i click on Edit from Detail page, then Url is http://localhost:23495/Vehicle/Edit/2
So now I click on another link, page is postback.
It is not on layout state of dashboard, isn't it?
It's depend on MileageStats.min.js file ?
How can i fix it?

Thanks project again.

May 5, 2011 at 5:35 PM


Thanks - we're glad you like it!  You are correct that some areas of the site (such as editing a vehicle) leave the JavaScript-based dashboard and move to a post-back model. Because we use the BBQ library which uses the fragment (#) in the URL, the server does not redirect back to the dashboard.  The result is that the user is stuck in a non-JavaScript experience until they navigate back to the dashboard.  Note: There is some JavaScript on the vehicle add/edit page to help with the drop-downs, but it is independent of the dashboard.

We would have liked to have the entire site be interactive JavasScript, but we decided to leave some pages in post-back mode for a couple of reasons.  First, we had limited time and resources.  Second, the team felt the key examples of how to write interactive JavaScript were covered in the dashboard page - having all the pages JavaScript-based would be better, but it didn't significantly improve the guidance.  Lastly, we recognized that this is a reference implementation and not a product, so it will be deliberately incomplete.

So, what would need to be done to fix these issues?  There are a couple of approaches:

1) Add functionality to the dashboard to remain in the interactive JavaScript.  This would require converting the HTML structure of the post-back pages into templates and including them in the _Layout.cshtml.  Then you would need to write the appropriate widgets and update the dashboard code to request data from the server, apply the templates, handle form submission, and integrate the navigation.  On the server, you may need to author some additional JSON methods to get the data to the client.

2) If you want to leave the pages as post-back, you could update the server to redirect to a URL that includes the right hash tag.  This might require sending the server a query string containing the fragment as the server has no knowledge of client navigation. 

If you decide to update the Mileage Stats reference implementation will a full JavaScript experience, reply to this thread to get in touch with the team.  The team may be able to accept it as a contrib project (given all the licensing stuff works out).  You can fork from the Mercurial project on this site.

Thanks again,

Geoff Cox
Southworks, Inc.
on behalf of Microsoft Patterns and Practices.

May 6, 2011 at 9:32 AM
Edited May 6, 2011 at 9:44 AM

Hi Geoff,

I' will happy if i can join with your team.

So, what will I do first step to work with, and upgrade project...

Back to my problem...

First my simple task, Profile page:

_ Fragment the URL http://localhost:23495/Dashboard#layout=profile

_ I created "mstats.profile.js" with widget name is:  mstats.profile
_ added function "_goToProfileLayout" into "mstats.layout-manager.js"

I have few line of code:

if(!mstats.profile.options.isOnScreen) {

i got stuck there...

 ==> mstats.profile is underfined

mstats have some elements are "charts, fillup, infoPane, vehicleDetail, vehicleList ... etc" but no profile

Thanks for helping.
Thanks for your Team, Geoff.

May 7, 2011 at 1:09 PM
Edited May 7, 2011 at 1:09 PM

i already enable widget at "mileagestats.js"





I do not know why mstats does not have profile widget.

I miss something?


Thanks for help!






May 9, 2011 at 1:58 PM

You are correct, we didn't include a profile widget. The team didn't have time to create a widget for each of the forms, profile, add vehicle, and edit vehicle.

Have a nice day,




May 17, 2011 at 3:47 PM

Hi i would like to intruce a div into the vehicles/List file to create an accordeon report for the vehicles with a new widget; which framework (if any) would you recomend to create this report and have the possibility to export to pdf and excel?