views:

65

answers:

3

Hi Experts,,,

I wanna have a base page for all my content editing pages with a save and delete buttons at the bottom. is that possible? how?

if not, is there an alternative way? I think master pages won't work because it's not a site wide page layout it's just for edit pages.

+1  A: 

HI Bassel,

You can have a separate master page an set only the edit pages to use it.

Asaf

Asaf R
then I'll have to use event handling in the content page to handle an even that was raised by the master page.is that all?is there another way?
Bassel Alkhateeb
+1  A: 

You can certainly dynamically add controls in a base page. However, base page classes don't have any markup, so specifying the controls as being at the bottom of the page is a little tricky.

If Master pages won't work for you, another approach would be to encapsulate your buttons in a user control, and then place that control at the bottom of your pages. You could create the control so that it interacts easily with the rest of the page in terms of events, etc.

RickNZ
thanks you answered my question.
Bassel Alkhateeb
A: 

Another option - and approaching the problem from a slightly different angle - is to have a single ASPX page for all edit pages then create ASCX user controls that contain all the UI (and possibly processing logic) for each "logical" page.

For example, having a single Edit.aspx and UserEdit.ascx, CategoryEdit.ascx, WigitEdit.ascx, etc.

You can then pass in a parameter via a form post or querystring to identify the specific page to display. Processing code can be encapsulated in either the parent ASPX page or the individual user controls, however execution is initiated via the events of the buttons on the parent page.

Showing/hiding individual ASCX user controls can be done via dynamic control loading, placing all ASCX on the page and setting their Visible property, using the ASP.NET Multiview control (or others), etc. There are many options.

The key is to think carefully about what your trying to achieve and the overall design of your application. And remember, there's always more than one way to skin a cat.

Something else to consider is the ongoing maintenance effort of having a single button solution (and possible complexity of implementing it) versus a "copy and paste" type solution of implementing the same code across multiple pages. Sometimes "copy and paste" is best - at least in the beginning. If you have only 5 pages for example, the copy and paste approach may be best in the beginning and experience will give you more options in the future.

Jason Snelders
I don't know how I didn't think about it though... I did that before in WinForms. thank for the answer.
Bassel Alkhateeb