0

I'm working on a custom web application and because I have many separate blocks I want to put them on a different page, I was wondering how can I include aspx content on existing page? the reason I'm asking about aspx, and not custom web controls, is because I planned to use pagemethods on those separate pages. Another reason is that I saw someone some saying we can do that, can't find the link now, so thought I'll try too, since it looks very neat:) Thanks

Pavdro
  • 411
  • 1
  • 9
  • 18

2 Answers2

2

Server.Execute (secondUrl) might do what you want. But UserControls are definitely more ASP.Net-ish :).

iZ.
  • 4,951
  • 5
  • 23
  • 16
0

Based on what you describe, the proper answer is custom controls as they allow you to place the code anywhere on any page in an easily reusable manner.

Can you explain what you mean by "aspx content" - is that just html, is it controls? Also, what Page methods are you referring to?

Dave Wise
  • 306
  • 1
  • 4
  • yeah, I was referring to this post http://stackoverflow.com/questions/579024/calling-an-ascx-page-method-using-jqery people advice the guy create aspx page for pagemethods, rather than user control, so I was wondering can I also include aspx page on another or is it just for calling PageMethods only:) – Pavdro Apr 13 '11 at 09:01
  • Can I assume you are are trying to load content into a div via ajax? If that is the case, and you have no need of server-side processing, why don't you just load .html files that contain the final html you want? – Dave Wise Apr 14 '11 at 04:44
  • well, as I stated in my first post, I wanted to have pagemethods on those pages, otherwise I could just use custom controls. But yeah, think I can do the content loading myself. Like you said, I'll just have aspx page and call ajax query to load the content of it into my div:) – Pavdro Apr 14 '11 at 09:28
  • One other approach would be to create your own custom Page class that inherits from the default Page object and then add all of the methods you want to use on that. From there, simply change the base page that your .ASPX pages use to use your custom Page object instead. – Dave Wise Apr 14 '11 at 12:21
  • @Dave, sorry, think I don't understand how it would help me :s if I create custom Page class and use it in my pages will that allow me to include .aspx page in another .aspx pages? Don't get it :s – Pavdro Apr 22 '11 at 10:18
  • It wouldn't let you include other aspx pages in one, it would eliminate the need to do that at all by embedding those methods into the page itself. This would make those methods available on every page that inherited from your new custom page class – Dave Wise Apr 22 '11 at 13:06