我如何...将所选项目从一页下载到另一页 [英] How do I...carry dropdown selected item from one page to another
问题描述
protected void BtnSubmit_Click(object sender,EventArgs e)
{
Division = DdlDivision.SelectedItem.ToString();
DataTable dt = getInfo.GetDivision(Division,UserName);
}
protected void BtnAdd_Click(object sender,EventArgs e)
{
Division = DdlDivision.SelectedItem.ToString();
Response.Redirect(FormAddition.aspx);
}
嗨大家好,我需要帮助才能将dDl.selectedItem从一个页面保留到另一个页面
这是我在FormConfirm.aspx中的编码,我试图在DDlDivision中设置相同的值,以便在表单加载时转到FormAddition.aspx。
1.它应该采用FormConfirm.aspx的DDlDivision.selectedItem当它重定向到FormAddition.aspx时保留它
2.当在FormAddition.aspx中并且用户决定改变ddlDivision中的SelectedItem时它应该在b时保留点击返回FormConfirm.aspx的utton。
任何sugestions都将受到高度赞赏..谢谢提前
protected void BtnSubmit_Click(object sender, EventArgs e)
{
Division = DdlDivision.SelectedItem.ToString();
DataTable dt = getInfo.GetDivision(Division, UserName);
}
protected void BtnAdd_Click(object sender, EventArgs e)
{
Division = DdlDivision.SelectedItem.ToString();
Response.Redirect("FormAddition.aspx");
}
Hi Guys, i need help to retain dDl.selectedItem from one page to another
this is the coding in my FormConfirm.aspx, and i am trying to set the same value in the DDlDivision to go to FormAddition.aspx on form load.
1. it should take the FormConfirm.aspx's DDlDivision.selectedItem and retain it when it redirects to FormAddition.aspx
2.when in FormAddition.aspx and user decides to chenge the SelectedItem in the ddlDivision it should be retained when the button to go back to FormConfirm.aspx is clicked.
any sugestions will be highlly appreciated ..Thanks in advance
推荐答案
您可以使用会话变量。在会话中存储所选项目值。
在FormAddition.aspx上,您可以从会话中检索该值并使用它。
即使用户返回FormConfirm.aspx,您可以再次从会话中检索值并将其指向您的下拉选择。
You can make use of session variable. Store selected item value in session.
On FormAddition.aspx, you can retrieve that value from session and use it.
Even if user goes back to FormConfirm.aspx, you can again retrieve value from session and point it to your dropdown selection.
我认为您最好的选择是将它放在Session变量中。虽然你可以使用查询字符串,但从长远来看它可能会变得复杂。
使用会话,只要用户会话处于活动状态就可以保存数据,你可以在任何页面上使用它,而不是就在这两页上。
但是,如果这将是面向客户的高容量网站,您应该了解在proc / outproc中使用它的利弊,应用程序池回收的影响等等。
希望有所帮助。
I think your best bet would be to put it in Session variable. Though you can use querystring and all but in the long term it may get complicated.
With session, you can keep data as long as the user session is active and you can use it on any page, not just on these two pages.
Though, if this is going to be customer facing high volume site, you should be aware of pros and cons of using it inproc/outproc, impact of app pool recycling etc.
Hope that helps.
你可以使用查询字符串,但在查询字符串值中会显示另一个哟可以使用会话变量。
查询字符串: -
Response.Redirect(FormAddition.aspx ?id =Division);
和On Addition页面
你可以获得页面加载的价值
string str = Request.QueryString(id)。ToString();
会话:
会话[str] =分部;
You can be use query string but in query string value would be show and another yo can be use session variable.
Query String:-
Response.Redirect("FormAddition.aspx?id="Division);
And On Addition Page
You can get value on page load
string str=Request.QueryString("id").ToString();
Session:
Session["str"]=Division;
这篇关于我如何...将所选项目从一页下载到另一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!