views:

1373

answers:

2

I know (at least i'm pretty sure) there isn't a control for MVC like the asp:UpdatePanel. Can anyone give me some idea on how to do this.

I have a collection that i add entries to from my repository & services layers. in my masterpage i would like to show an alert depending on if there is anything in this collection.

Normally i would have an UpdatePanel whose UpdateMode="Always" and it would check the collection and display my messages.

Do you know how i can achieve something similiar in MVC?

+3  A: 

Stay away from the UpdatePanel concept all together.

ASP.NET MVC includes jQuery, which is fully supported by Microsoft now. You will want to create partial views (RenderPartial) that make calls back to a method on a controller, that returns JSON.

Then, use jQuery to wire up the control and partial views.

jQuery is an extremely powerful javascript library. I highly recommend the book jQuery in Action as a reference when diving into the ASP.NET MVC /Scripts/jquery-x.x.x.js files. :)

eduncan911
+2  A: 

I use Ajax.BeginForm() with a partial view callback. and do all my code behind in the controller. works like a charm and you can even overload all the methods like OnSuccess OnFailure and OnComplete. There is a lot of functionality using this. :P

Ayo