473,387 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Fluent page navigation

Hi there - I'm trying to figure out how to model a fluent interface for
asp.net page navigation and am getting stuck - wondering if anyone has ideas
on how to accomplish something like the following:

public class Page1 : BasePage
{
public class InputParameters : PageInputParameters<Page1>
{
public DateTime StartDate;
public InputParameters( DateTime startDate ) { this.StartDate =
startDate; }
public override string BuildNavigateUrl() { return
ParentPage.AppRelativeUrl + "?rid=" + this.ReportId; }
}

public void RedirectUser()
{
// TODO: determine how to build/model this...
NavController.NavigateToPage<Page2>().WithParams( 1 );
}
}

public class Page2 : BasePage
{
public class InputParameters : PageInputParameters<Page2>
{
public int ReportId;
public InputParameters( int reportId ) { this.ReportId = reportId; }
public override string BuildNavigateUrl() { return
ParentPage.AppRelativeUrl + "?rid=" + this.ReportId; }
}

public void RedirectUser()
{
// TODO: determine how to build/model this...
NavController.NavigateToPage<Page3>().WithParams( "test name" );
}
}

public class Page3 : BasePage
{
public class InputParameters : PageInputParameters<Page3>
{
public string Name;
public InputParameters( string name ) { this.Name = name; }
public override string BuildNavigateUrl() { return
ParentPage.AppRelativeUrl + "?rid=" + this.ReportId; }
}

public void RedirectUser()
{
NavController.NavigateToPage<Page3>().WithParams( DateTime.Today );
}
}

public abstract class PageInputParameters<AssociatedPageTypewhere
AssociatedPageType : BasePage
{
public BasePage ParentPage { get { return default(AssociatedPageType); } }
public void NavigateToPage() { HttpContext.Current.Response.Redirect(
this.BuildNavigateUrl() ); }
public virtual string BuildNavigateUrl() { return
ParentPage.AppRelativeUrl; }
}

public abstract class BasePage : System.Web.UI.Page
{
public abstract string AppRelativeUrl { get; }
}

It doesn't seem possible, given my approach, since NavigateToPage<T>() would
need to return a dynamic interface that declares WithParams() - but the input
parameters to that method would need to be dynamic - not sure how to
accomplish that (if it could be accomplished at all).

Thanks for any ideas/help anyone can give!
Jul 18 '08 #1
0 1044

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Jonathan Snook | last post by:
I've been contemplating what the recommended usage of a "top of page" link should be? Should there only ever be one at the bottom of the page? Should they be sprinkled at various points on the...
30
by: Rhino | last post by:
I am giving some thought to applying for some jobs that want people with Java and C++ experience. I have been writing Java for several years and am fluent enough that I don't have to get help with...
1
by: dezza | last post by:
Hi, I am developing a web application that is a series of pages, rather like a wizard. Because all of the pages basically have the same navigation, and require the navigation buttons in the...
28
by: laredotornado | last post by:
Hi, Surprisingly, I can't get the drop down menus to work on PC IE 6. If you roll over "PRODUCTS", normally a drop down menu appears (on Safari and Firefox), but on PC IE, nada. ...
5
by: Bill Davidson | last post by:
All: Pardon the newbie question, but let's say I've got two pages in my website: Welcome.aspx NoNav.aspx I want users to be able to navigate to the welcome.aspx page (e.g....
8
by: Amit | last post by:
I have a master page and a content page but the stylesheet isnt getting applied like how it looks in visual studio design view. The master page is defined like this: <%@ Master Language="VB"...
5
RMWChaos
by: RMWChaos | last post by:
Apparently, I can't do anything the easy way, which seems to lead me here so very, very often. Here is what I am trying to do this time: 1. Autogenerate two navigation bars, "navLeft" and...
3
by: rassklass | last post by:
HI all, I have designed a site found at www.pickupnewspapers.co.uk/nottinghamshire/index.html but I cant get the footer to sit stil on the page. It is because of the javascript ticker, everytime...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.