Can I load ASCX using jQuery.load ()?

Is it possible without encapsulating these controls in aspx files? The Register shortcut makes me think that this is not the case.

0
jquery asp.net-ajax ascx
source share
6 answers

You cannot directly link to the ascx page, they cannot serve any html without adding to aspx or rendering, and then dynamically in response to any page / handler.

+2
source share

One possible way would be to have a common aspx stub page that will act as the host for ascx in a regular web form, call back on that page using the jquery $ .ajax () method with some arguments to indicate that which you want to download.

Then, on your stub / host page, override the rendering method and render the control directly to the output stream using response.output.write. The client callback handler will catch the output, and then it can be inserted into the DOM in the usual way or using the version of $ .load (), which allows you to specify the DOM element.

hope this helps.

+2
source share

As I started using jQuery / Ajax more and more, I believe that I use server controls more and more.

Things I used to manage are now separate aspx pages that load in the panel.

If you have old ASCX files, it should not be too difficult to convert them to ASPX

0
source share

Not.

However, you can place ascx inside the UpdatePanel and set the panel contents to be visible / invisible using standard Asp.Net postback mechanisms.

Or you can write a separate IHttpHandler that generates HTML code that your Javascript code adds to the page using the DOM. However, this part of the page will not be available in PostBack.

0
source share

No, ASCX are user controls that exist in ASPX. You will need to make it a page or convert it to a handler.

-one
source share

All Articles