ASP.NET
-
Hi folks, Lately I have been spending some time attempting to get my head around ASP.NET. One on the exercises I have set myself is to build a modest little website. But I have run into a few design problems that I hope some one can help me with. I have decided to have a standard header to each page. (Just like code project has the standard header at the top of this page.) In pure ASP I would have had these as a SSI (eg . In ASP.NET this still works but when I attempt to add make the header a bit smarter by making it a WebForm things get all confused. This happens because they are each seperate pages with seperate C# code behind them. Which means there is two <@ Page ...> directives. Which means it doesn't work! What is the proper design pattern/model to acheive this type of behaviour? I hope this makes sense to you all... Matt ------ Accept that some days you are the pigeon and some days the statue.
-
Hi folks, Lately I have been spending some time attempting to get my head around ASP.NET. One on the exercises I have set myself is to build a modest little website. But I have run into a few design problems that I hope some one can help me with. I have decided to have a standard header to each page. (Just like code project has the standard header at the top of this page.) In pure ASP I would have had these as a SSI (eg . In ASP.NET this still works but when I attempt to add make the header a bit smarter by making it a WebForm things get all confused. This happens because they are each seperate pages with seperate C# code behind them. Which means there is two <@ Page ...> directives. Which means it doesn't work! What is the proper design pattern/model to acheive this type of behaviour? I hope this makes sense to you all... Matt ------ Accept that some days you are the pigeon and some days the statue.
-
-
thanks for the tip. I am having a look at ibuyspy right now! Matt ------ Accept that some days you are the pigeon and some days the statue.
There are 2 choices, you could compile your own control into a dll, or you could make a UserControl file, with an ascx extension. Judging by the fact that you are making a header, i'm betting you want to make a UserControl, which is much like the old asp include file, except much much cooler. here's the msdn docs on UserControls, ( watch for wrapping ) http://msdn.microsoft.com/library/?url=/library/en-us/cpref/html/cpref\_start.asp?frame=true
-
There are 2 choices, you could compile your own control into a dll, or you could make a UserControl file, with an ascx extension. Judging by the fact that you are making a header, i'm betting you want to make a UserControl, which is much like the old asp include file, except much much cooler. here's the msdn docs on UserControls, ( watch for wrapping ) http://msdn.microsoft.com/library/?url=/library/en-us/cpref/html/cpref\_start.asp?frame=true
-
Hi folks, Lately I have been spending some time attempting to get my head around ASP.NET. One on the exercises I have set myself is to build a modest little website. But I have run into a few design problems that I hope some one can help me with. I have decided to have a standard header to each page. (Just like code project has the standard header at the top of this page.) In pure ASP I would have had these as a SSI (eg . In ASP.NET this still works but when I attempt to add make the header a bit smarter by making it a WebForm things get all confused. This happens because they are each seperate pages with seperate C# code behind them. Which means there is two <@ Page ...> directives. Which means it doesn't work! What is the proper design pattern/model to acheive this type of behaviour? I hope this makes sense to you all... Matt ------ Accept that some days you are the pigeon and some days the statue.
Matt, You can make that header two ways. 1.) make it a Web User Control and then on any page you want that headret you simply insert your header user control. You also could implement the Application BeginRequest event in the global.asax file. Like this and emit a header without having to explicitly add it to each page. Sub Application_BeginRequest(sender As Object, e As EventArgs) ' emit page header Context.Response.Write("" + ControlChars.Lf + _ "" + ControlChars.Lf + "
" + _ ControlChars.Lf) End Sub Good Luck, Martin Garins