Padarn Master Pages (or how do I include .aspx pages) - asp.net

Does Padarn support the concept of .NET Master Pages and/or the concept of Classic ASP #include?
I would like to reuse my .aspx pages in other .aspx pages as well as implement a single Header & Footer for the web site.
It appears as though Padarn doesn't support .aspx page reuse explicitly and that, maybe, I will need to dynamically generate/call Document objects within a Padarn Page to simulate the Master Page effect.
Before I try to get clever with simulating .aspx reuse within the Padarn framework, I would like to know if there is built-in support for this and/or if there is a best practice for this.

Padarn doesn't have built-in support for master pages or classic ASP syntax. For page element re-use (headers, footers, menus, etc) we typically use a base class in the code behind where we have methods that can render these elements. We then derive pages from the base to get the common functionality.

Related

Add an asp code into another asp

In jsp and php it's very common to have files with pieces of HTML/Java/PHP code and have other jsp/php files consume them. That's fundamental for reusability.
In asp, M$ created another approach, master pages. But I'm having trouble to get used to it, to be forced to have ALL reusable code in a unique file. In example, some apps with many pages may have a breadcrumb area, while simpler apps won't need it.
Yes I can put those blocks inside a ContentPlaceHolder and just add them empty to asp pages they aren't needed. But I'd rather have them on their own files and include them when needed, instead of "removing" them when not needed.
Another example is about menus. Each app has its own menu. In jsp and PHP I can have a local file with the HTML menu and add it. In asp, the best I could imagine is have the "master master page" with an example menu code, then have a local "nested master page" only with local app's menu, and have asp files consume that "nested master page".
Is it the only way to do these stuff? Or is there a better way for doing it?
You have many choices with ASP.NET web forms.
If you just need to share server code, such as utility functions, you can add additional classes to your web project and instantiate/call them just like any other code. Classes added in this manner are accessible to all of your pages.
If you want to share server side code across multiple projects, you can create a new project of type "Class Library," compile it, and set a reference to the resulting DLL from all of your web projects.
If you have a page snippet or section (e.g. a menu system) that is common across pages, you have two choices: custom controls or user controls.
Custom Controls: these are controls written from scratch exclusively using code. Essentially, you write a class which extends Control (directly or indirectly), and you take care of everything. You need to write logic to create child controls that you want to use, and you override the Render method to perform rendering. Typically, you build this control into a redistributable assembly (i.e. a DLL), which can then be used by any ASP.NET applications, simply by placing the assembly in the 'bin' directory of the app (or in the Global Assembly Cache).
User Controls: these control are written using an ascx file, which looks much like an aspx page. i.e. you can simply drag and drop the UI elements that you want to use into the design surface. You don't need to worry about control creation, nor about overriding the Render method.
Sounds to me like you want a user control in this scenario. Here is a helpful walkthrough to get you started.
I will echo scheien's sentiment and tell you that you might want to look carefully at MVC, which is totally different but might fit better with your PHP mindset.

When developing custom SharePoint application pages, should I use SharePoint web controls instead of ASP.NET controls?

I'd like to create a couple of custom application pages with native SharePoint 2010 look and feel. So far, I've been drag-and-dropping ASP.NET components into user controls in VS2010, then applying SharePoint's css via CssClass properties.
Now I've noticed that SharePoint aspx pages internally use a lot of SharePoint tags like <SharePoint:UIVersionedContent>, <SharePoint:SPLinkButton>, <wssawc:InputFormTextBox> etc. instead of the usual ASP.NET controls (like <asp:LinkButton>). However, there is no way known to me to create SharePoint pages with the native components other than manually dissecting existing aspx pages and trying to figure what mysterious tags and elements SharePoint uses, then try to emulate this in my own page, line by line.
Should I be worried that I'm using normal ASP.NET tags instead of <SharePoint:*> tags? Is there a better way to create SharePoint-friendly native custom pages other than manually coding everything through trial-and-error?
You can use standard ASP.NET control (or any other) in SharePoint pages however you will need to customize them by CCS styles to look SharePoint-like. It's possible but sometimes time consuming.
On the other hand you can use SharePoint controls. They have SharePoint look out of the box and are prepared for the use in SharePoint. E.g. they can use SharePoint objects directly as data sources etc. Moreover it would be hard to implement some SharePoint controls as PeoplePicker using standard ASP.NET controls, CCS and code-behind.

How to include asp.net user control in .htm pages

I am creating one website where all pages are creating in html but dynamic pages are creating in asp.net. I have one problem in my all static html pages i want to display one user control in one form but pages are .html thats why pages do not support asp.net control. How can i do pls let me khnow if anybody know.
I don't think this is possible, unless you use an iframe which contains an asp.net page containing the user control.
Furthermore, if it is possible, I don't think this approach should be used. It would make more sense to convert the .htm files to .aspx files, and use rewriting to display them as .htm if this is needed.
You simply can't. Html pages don't get processed by your ASP.NET engine. You could change them into .aspx files, and include the control, preferably within the form-tag of the asp.net page.

Is it possible to use sharepoint master page in a separate application as parent master page

Is it possible to inherit a sharepoint master page(as a parent) in another application's master page which will be treated as child (i.e. after integrating that standalone application with the sharepoint application)? I am totally new to Sharepoint...Any links or article source related to this will be highly appreciated.
Regards,
DC
I would suggest use nested master page
Depends
SharePoint master pages are just other .Net masterpages. However if you're planning to use the same custom.master file, you will most probably receive errors because your stand alone application won't be able to find the SharePoint controls referenced on your .master file.
If you're talking about just a code behind, unless your the parent master class does SharePoint specific tasks, I don't see why you shouldn't be able to inherit from it in your standalone application.
If the reason you want to create the separate application is because you don't think its possible to put in standalone pages into SharePoint.. I've written a blog post to do this here: http://blog.zebsadiq.com/post/How-to-add-a-standalone-aspx-pages-to-SharePoint-navigation.aspx
[Edit]
Nested masterpage theory:
I've never tried this but you could:
Refactor your SharePoint masterpage so that it uses a nested structure
Stick parent.master in the /layouts/MyMasterpage/ Folder, The parent.master file by default will contain all SharePoint components. Wherever you define SharePoint controls, you put a custom placeholder tag around it.
Then create two children master pages, child1.master could then inherit from /layouts/MyMasterpage/parent.master. Additionally it could be installed AS the masterpage of your SharePoint site (via a feature). In theory, your Sharepoint site should work fine because parent.master has everything SharePoint needs, defined on it.
Child2.master could be your inherit from parent.master. It can override all placeholders that contain SharePoint specific controls. While obviously accommodating your forums application.
You may not be able to place a copy of parent.master in a place where both applications can see it but you might be able to duplicate the parent.master and its relating css files for both SharePoint and Forums. (Then you'll have to manage both).
This may or may not work, give it a go.

Partial rendering of an ASP.NET site

I have an ASP.NET application which calls aspx-pages in other ASP.NET applications (all on the same server and the same solution). This aspx-pages should be shown in a (fixed) region on the main-site in that way that that only the embedded pages is renewed, during user interactions there. Is an IFRAME the only way to achieve this goal, or can I use for example the AJAX update-panel or are there further possibilities / techniques. I have read something about the a control "UFRAME". Maybe this is the solution for my question !?!?
If you want to display a page within another page, you'll need to use frames or an i-frame. If you have access to all the code for these other ASPX pages though, it would probably be better to use User Controls (ASCX files) instead. You can then easily re-use these in as many pages as you like.

Resources