Geeks With Blogs

News

Google My Blog

Catch me at: The List!


My InstallScript Utility Belt My Amazon Wishlist
My Standard Disclaimer


Archives
Chris G. Williams Beware: I mix tech and personal interests here.

I've been working with MVC for a little bit lately, and I've run into a really bizarre problem. I'm hoping someone can help me figure it out.

Everything "appears" to work fine when the page first loads. I have a dropdown with three values and a chart which displays some data based on the value selected in the dropdown.

Making a selection from the dropdown causes a roundtrip to the server. (This is good)

I can SEE new data if I step through the code in my View. (This is good)

The dropdown displays the newly selected value on the page. (This is good)

However, nothing else on the page changes! None of the new data shows up. It's all still the data from the initial page load (except the dropdown list).

WTF?!?!

I put in some temp variables in the View and grabbed some values from the ViewData and Response.Write them to the screen. When I step through the code, they have the correct value, but when I look at the web page, where I did the Response.Write calls, it still displays the values from the initial page load.

Any help would be greatly appreciated.

Posted on Monday, June 15, 2009 4:36 PM | Back to top


Comments on this post: MVC Bizarro World

# re: MVC Bizarro World
Requesting Gravatar...
It's been a while since I did ASP.NET, but I remember a similar problem when I dealt with user controls. It had to do with when the controls were initialized. I moved them further up the event stack and they would work.

Sorry, I don't have specifics, but hopefully it leads to something.

If you repost again, does the data change to the last value? As in always being one post behind? I'm pretty sure that was my symptom.
Left by Anachostic on Jun 15, 2009 7:56 PM

# re: MVC Bizarro World
Requesting Gravatar...
Sounds like an IE cache problem. Try setting IE from "Automatically" to "Everytime"

(Tools->Options->Settings button.
Left by Rob on Jun 15, 2009 10:25 PM

# re: MVC Bizarro World
Requesting Gravatar...
It's definitely not limited to IE8. Same thing happens in Chrome and FF3. Oh and I'm currently running it on PWS from within Visual Studio 2008, if that helps anyone.
Left by Chris G. Williams on Jun 15, 2009 10:48 PM

# re: MVC Bizarro World
Requesting Gravatar...
Chris,
What's the target for the rendered view? I do remember hitting this when I started working with MVC as well, I'll look back and see if I can find what it was.
Left by Michael Cummings on Jun 16, 2009 5:11 AM

# re: MVC Bizarro World
Requesting Gravatar...
I helped Chris with this last night ... together we figured it out.

JQuery was requesting through XmlHttpRequest and the action on the controller for the post was returning a view, causing a 302 redirect which Jquery was swallowing. All fixed. IT was sooo baffling to see what it was doing. Very odd. But it works now!

Donn
Left by Donn Felker on Jun 16, 2009 8:31 AM

# re: MVC Bizarro World
Requesting Gravatar...
You're a lifesaver!! Thanks man!
Left by Chris G. Williams on Jun 16, 2009 8:35 AM

# re: MVC Bizarro World
Requesting Gravatar...
Just in case someone else finds this, we changed the JQuery from this:

$.post(...) to
$("#mycontainer").submit();

All bueno.
Left by Donn on Jun 16, 2009 8:36 AM

Your comment:
 (will show your gravatar)


Copyright © Chris G. Williams | Powered by: GeeksWithBlogs.net