Reputation: 4942
I would like to update a certain part of the page with content from another *.aspx page, thus avoiding having to have just one (very) long page of code.
So: How can I load an aspx page in another aspx page in a specific tag, without having to reload the entire page.
Upvotes: 1
Views: 2005
Reputation: 4789
If you are using Webforms (and it sounds like you are), you might want to look into User Controls (ascx pages). If you are using MVC, consider a Partial View.
Upvotes: 2
Reputation: 504
I think conceptually you're going about this with the wrong approach. Besides avoiding a very long page of code, what are you trying to accomplish? There are many ways to pull code out of a class, without necessarily touching your display code. Also try ASP.Net web controls, as they allow you to have reusable view objects.
If you're interested in refreshing the page in pieces, look at AJAX.
Upvotes: 0
Reputation: 48596
If you want to load the content after the initial page has loaded, you can use jQuery's ajax() method to load up that page and store the result in the div you want. Otherwise, putting your code in a web control and placing that control on the page will work.
Upvotes: 0
Reputation: 887415
You need to use AJAX.
You can either put an ASP.Net UserControl in an <asp:UpdatePanel>
, or (preferably) use jQuery.load
Upvotes: 2
Reputation: 190945
Use a web control. That way its all inside there and reusable.
Upvotes: 1