私の問題を解決する答えは見つけられません。セッションからの戻り値
私は、データベースに入力を送信してセッションを作成するASPページを持っています。私はそのセッションで特定の価値を返す方法を知りたいです別の aspxページ。
page1.aspx.cs私はから値QuestionnaireName.Textを希望
public partial class new_questionnaire : System.Web.UI.Page
{
OscarSQL c;
protected void Page_Load(object sender, EventArgs e)
{
c = new OscarSQL();
} // End Page_Load
////// Button Method //////
protected void NewQnrButton_Click(object sender, EventArgs e)
{
// Check if the input fields are empty.
if (QuestionnaireName.Text == "" || CustomerID.Text == "" || NumberOfQuest.Text == "")
{
Error.Text = "Please enter a name for your questionnaire.";
}
// Parse input values to OscarSQL.
else
{
int testRet = c.InsertQuestionnaire(QuestionnaireName.Text, Int32.Parse(CustomerID.Text), Int32.Parse(NumberOfQuest.Text));
Session["Questionnaire"] = testRet;
Confirm.Text = "Your questionnaire has been named " + QuestionnaireName.Text;
Response.Redirect("~/add_questions.aspx");
}
} // End NewQNRButton_Click
} // End new_questionnaire
Page2.aspx.cs [ここで解析されるべき値をご希望]
namespace OSQARv0._1
{
public partial class WebForm2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//ReturnQnrName.Text here?
}
}
}
[セッションを作成します] Page1をReturnQnrName.Textに返すPage2
ありがとう、これは私にとってクリーンなソリューションでした。 – HGomez90