Created
June 21, 2012 04:25
-
-
Save masaru-b-cl/2963825 to your computer and use it in GitHub Desktop.
Survey
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<packages> | |
<package id="Navigation" version="1.4" /> | |
</packages> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Question1.aspx.cs" Inherits="Question1" %> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head runat="server"> | |
<title></title> | |
</head> | |
<body> | |
<form id="form1" runat="server"> | |
<h1> | |
Question 1</h1> | |
<h2> | |
Which ASP.NET technology are you currently using?</h2> | |
<asp:RadioButtonList ID="Answer" runat="server"> | |
<asp:ListItem Text="Web Forms" Selected="True" /> | |
<asp:ListItem Text="MVC" /> | |
</asp:RadioButtonList> | |
<asp:Button ID="Next" runat="server" Text="Next" onclick="Next_Click" /> | |
</form> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.UI; | |
using System.Web.UI.WebControls; | |
using Navigation; | |
public partial class Question1 : System.Web.UI.Page | |
{ | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
if (!Page.IsPostBack) | |
{ | |
if (StateContext.Data["answer"] != null) | |
{ | |
Answer.SelectedValue = StateContext.Data["answer"] as string; | |
} | |
} | |
} | |
protected void Next_Click(object sender, EventArgs e) | |
{ | |
StateContext.Data["answer"] = Answer.SelectedValue; | |
var data = new NavigationData(); | |
data["technology"] = Answer.SelectedValue; | |
if (Answer.SelectedValue != "MVC") | |
{ | |
StateController.Navigate("Next", data); | |
} | |
else | |
{ | |
StateController.Navigate("Next_MVC", data); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Question2.aspx.cs" Inherits="Question2" %> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head runat="server"> | |
<title></title> | |
</head> | |
<body> | |
<form id="form1" runat="server"> | |
<h1> | |
Question 1</h1> | |
<asp:HyperLink ID="Question1" runat="server" Text="Question 1" /> | |
<h2> | |
Are you using the Navigation for ASP.NET Web Forms framework?</h2> | |
<asp:RadioButtonList ID="Answer" runat="server"> | |
<asp:ListItem Text="Yes" /> | |
<asp:ListItem Text="No" /> | |
</asp:RadioButtonList> | |
<asp:Button ID="Next" runat="server" Text="Next" OnClick="Next_Click" /> | |
</form> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.UI; | |
using System.Web.UI.WebControls; | |
using Navigation; | |
public partial class Question2 : System.Web.UI.Page | |
{ | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
Question1.NavigateUrl = StateController.GetNavigationBackLink(1); | |
} | |
protected void Next_Click(object sender, EventArgs e) | |
{ | |
var data = new NavigationData(true); | |
data["navigation"] = Answer.SelectedValue == "Yes"; | |
StateController.Navigate("Next", data); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<StateInfo> | |
<dialog key="Survey" initial="Question1" path="~/Question1.aspx"> | |
<state key="Question1" page="~/Question1.aspx"> | |
<transition key="Next" to="Question2" /> | |
<transition key="Next_MVC" to="Thanks" /> | |
</state> | |
<state key="Question2" page="~/Question2.aspx"> | |
<transition key="Next" to="Thanks" /> | |
</state> | |
<state key="Thanks" page="~/Thanks.aspx"> | |
</state> | |
</dialog> | |
</StateInfo> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Thanks.aspx.cs" Inherits="Thanks" %> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head runat="server"> | |
<title></title> | |
</head> | |
<body> | |
<form id="form1" runat="server"> | |
<h1> | |
Thanks</h1> | |
<asp:HyperLink ID="Question1" runat="server" Text="Question 1" /> | |
<asp:HyperLink ID="Question2" runat="server" Text="Question 2" /> | |
<h2> | |
Answers</h2> | |
<asp:Label ID="Summary" runat="server" /> | |
</form> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.UI; | |
using System.Web.UI.WebControls; | |
using Navigation; | |
public partial class Thanks : System.Web.UI.Page | |
{ | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
Summary.Text = StateContext.Data["technology"] as string; | |
if(StateContext.Data["navigation"] != null) | |
{ | |
Summary.Text += ", " + (bool)StateContext.Data["navigation"]; | |
} | |
if (StateController.CanNavigateBack(2)) | |
{ | |
Question1.NavigateUrl = StateController.GetNavigationBackLink(2); | |
Question2.NavigateUrl = StateController.GetNavigationBackLink(1); | |
} | |
else | |
{ | |
Question1.NavigateUrl = StateController.GetNavigationBackLink(1); | |
Question2.Visible = false; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<!-- | |
ASP.NET アプリケーションを構成する方法の詳細については、 | |
http://go.microsoft.com/fwlink/?LinkId=169433 を参照してください | |
--> | |
<configuration> | |
<configSections> | |
<sectionGroup name="Navigation"> | |
<section name="StateInfo" type="Navigation.StateInfoSectionHandler, Navigation"/> | |
</sectionGroup> | |
</configSections> | |
<system.web> | |
<compilation debug="true" targetFramework="4.0"> | |
<expressionBuilders> | |
<add expressionPrefix="NavigationData" type="Navigation.NavigationDataExpressionBuilder, Navigation"/> | |
</expressionBuilders> | |
</compilation> | |
</system.web> | |
<Navigation> | |
<StateInfo configSource="StateInfo.config"/> | |
</Navigation> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment