单击提交时,将变量传递到新页面 [英] Passing Variables to a new page, when clicking submit
问题描述
完成此任务的任何想法或建议。我使用asp:HyperLinkField做了类似的工作,但是我在目前的情况下不起作用。
你需要在第二页上发出数据来源的声明。
所以你有:
PostBackUrl =SecondPage.aspx
在SecondPage.aspx上,您声明在哪里可以获取信息
<%@ PreviousPageType VirtualPath =〜/ FirstPage.aspx%>
,您可以通过...获取...
if(Page.PreviousPage!= null)
{
if(Page.PreviousPage.IsCrossPagePostBack == true)
{
GetTheClass = PreviousPage.CustomDataClass;
//或者你找到你的控件,并获得你的数据
}
}
一些参考。
交叉页在ASP.NET网页中发布
I have a page with 2 dropdrownlists & a submit button. I would like to pass the values(variables) of the dropdownlists to another page when I click submit.
Any thoughts or suggestions as to accomplish this. I have done something similar to this using asp:HyperLinkField, but I this does not work in my current scenario.
You need to place a declaration on the second page where data come from.
So you have:
PostBackUrl="SecondPage.aspx"
On SecondPage.aspx you declare where you can get informations
<%@ PreviousPageType VirtualPath="~/FirstPage.aspx" %>
and you get them by...
if (Page.PreviousPage != null)
{
if(Page.PreviousPage.IsCrossPagePostBack == true)
{
GetTheClass = PreviousPage.CustomDataClass;
// or you find your control, and get your data
}
}
Some reference.
Cross-Page Posting in ASP.NET Web Pages
ASP.NET how to access public properties?
Cross-page postbacks and back again retaining data from source page
这篇关于单击提交时,将变量传递到新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!