传递变量到一个新的页面,点击提交时 [英] Passing Variables to a new page, when clicking submit

查看:120
本文介绍了传递变量到一个新的页面,点击提交时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2 dropdrownlists&放一个页面;一个提交按钮。我想通过dropdownlists到另一个页面的值(变量),当我点击提交。

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.

任何想法或建议,以实现这一目标。我做过类似这样使用ASP的东西:HyperLinkField字段,但我也不会出现在我的当前情况下正常工作

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.

所以,你有:

PostBackUrl="SecondPage.aspx"

在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
    }
}

一些参考。结果
在ASP.NET网页中跨页投递

<一个href=\"http://stackoverflow.com/questions/3036422/asp-net-how-to-access-public-properties/3036710#3036710\">ASP.NET如何访问公共属性?

<一个href=\"http://stackoverflow.com/questions/3736445/cross-page-postbacks-and-back-again-retaining-data-from-source-page/3736506#3736506\">Cross-page从源代码页回传,然后再返回保存数据

这篇关于传递变量到一个新的页面,点击提交时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆