views:

537

answers:

1

Hi everyone!

I have a UserControl that binds directly to database, that is, it's not rendered by any Action. It works independly.

But, from times to times I have to refresh it to get new information from database. I've already worked with refreshing UserControls in jQuery via Ajax, but in all of these cases, I had a Action to make the service.

But, this time I don't have a Action since this UC gets its information directly.

Does anyone know how to do this?

Thanks a lot!!

+2  A: 

UPDATE:

You need to call an action that returns the controls view. Example:

public ActionResult GetFooControl()
{
   return View("~/Views/Shared/Foo.ascx");
}

Then use the jQuery's load function to refresh the inner HTML for the control's container.

$('#mycontrolContainer').load('../MyController/GetFooControl');
Jose Basilio
José, I ended to use the load() but I used an Action just to call this UC... I don't know why it didn't work it for me without the Action, but thanks anyway!
AndreMiranda
Thank you for accepting my answer!
Jose Basilio