tags:

views:

24

answers:

1

I'm trying to get a certain fieldset to show up in a dialog box (using facebox) .. I've got the button set up, the dialog box and the HTML as a partial that I call .. The only thing is I don't know how to call the partial inside the jQuery..

Here is the jQuery:

   $('#addCatbutton').click(function() {
            jQuery.facebox('Add Category');
    });

Here is the asp.NET to add the html:

<% Html.RenderPartial("EditCategories", ViewModel); %>

Now I'm trying to get the facebox() to call that asp code .... any ideas on how I can do that?

A: 

You can't exactly do this the way it sounds like you're trying to do it. The ASP.NET code gets processed on the server side, and anything jQuery does directly is going to be on the client side.

However, if it is possible to have the HTML rendered at load time, you could go ahead and include that ASP.NET markup in your page. You would need to wrap it in an element that would be hidden, but that jQuery can then show. So, you would at least want to wrap it in a div with an id that could be shown through a javascript or jQuery call.

If you actually need to call .NET code from the page at runtime, you would need some sort of ajax call to a method to provide the actual HTML markup.

Andrew