I have a particular pattern I do NOT want to lose in ASP.Net 2.0, but I can't think of a way to reproduce it under the new code-beside/betwixt/whatever model.
I don't like every web form in an app having intimate knowledge about how every other form constructs and uses its QueryString. I'd much rather that the page itself be responsible... kind of a "page class in charge" model if you will. I did this under ASP.Net 1.1 like this:
Public Shared Function Url(param1 As Integer) As String
Return("~/Page1.aspx?param1=" & param1.ToString())
End Function
Where "Page1.aspx" is the actual name of the page in question, and "param1" would be named "startDate" or "id" or whatever is appropriate for that page. A page that wishes to "call" this one would do it like this:
Response.Redirect(Page1.Url(5))
This gets me type safety, intellisense, and no other page in the system needs to know or care about what order the parameters should go in, how to format them, or anything like that. Intellisense shows me at design time all the supported ways (overloads) I can call that page. It has served me well for quite a few projects now. The only problem is that it won't work in ASP.Net 2.0 because you can no longer refer to the page classes directly unless you move the code-behind to the App_Code directory and then you lose designer and intellisense support.
Microsoft broke one of my favorite tricks . Can anyone help me find a way to make this work again? I can write a helper class in App_Code, and put all the functions there, but it's just not the same. The information about how to navigate to a given page is no longer in the page itself.
MG2
Hi MG2,
Why dont you out this code in a BasePage class (and put this in app_code) ? Then you can derive all your pages from this base class and also access this common helper method too.
I think it should work.
Thanks
Vivek
I can solve your problem
Microsoft have release an update for Visual Studio 2005 to allow for Web Application projects so you can have a single assembly...pretty much reverting to the old 1.1 way but with the advantage of 2005 features. Here is the URL...
http://msdn.microsoft.com/asp.net/reference/infrastructure/wap/default.aspx
MelGrubb:I have a particular pattern I do NOT want to lose in ASP.Net 2.0, but I can't think of a way to reproduce it under the new code-beside/betwixt/whatever model.
I don't like every web form in an app having intimate knowledge about how every other form constructs and uses its QueryString. I'd much rather that the page itself be responsible... kind of a "page class in charge" model if you will. I did this under ASP.Net 1.1 like this:
Public Shared Function Url(param1 As Integer) As String
Return("~/Page1.aspx?param1=" & param1.ToString())
End FunctionWhere "Page1.aspx" is the actual name of the page in question, and "param1" would be named "startDate" or "id" or whatever is appropriate for that page. A page that wishes to "call" this one would do it like this:
Response.Redirect(Page1.Url(5))
This gets me type safety, intellisense, and no other page in the system needs to know or care about what order the parameters should go in, how to format them, or anything like that. Intellisense shows me at design time all the supported ways (overloads) I can call that page. It has served me well for quite a few projects now. The only problem is that it won't work in ASP.Net 2.0 because you can no longer refer to the page classes directly unless you move the code-behind to the App_Code directory and then you lose designer and intellisense support.
Microsoft broke one of my favorite tricks . Can anyone help me find a way to make this work again? I can write a helper class in App_Code, and put all the functions there, but it's just not the same. The information about how to navigate to a given page is no longer in the page itself.
MG2
Copyright (c) Marimer LLC