文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Asp.net中的页面传值

Asp.net中的页面传值

时间:2011-04-14  来源:晓宁

Asp.net中的页面传值方法:

1         Url传值:

2         Session

3         Cookie

4         Application

5         Response.Redirect()传值

6         最后在另外一个页面获得当前页面的控件中的值,在这里重点讲一下

首先在asp.net中只有Button linkButton imgButton有postbackUrl属性可以用来跨页传递控件的值

<asp:Button ID="Button1" runat="server" Text="Button" PostBackUrl="index.aspx" />

Index.aspx:

  if(Page.PreviousPage!=null)

     {

        if(Page.PreviousPage.IsCrossPagePostBack)

        {

            TextBox textControl=this.PreviousPage.FindControl("TextBox1") as TextBox;

 

            if(textControl.Text!=null)

             {

                 this.Label1.Text = textControl.Text;

             }

         }

    }

   PreviousPage:代表传递值的页面

IsCrossPagePostBack:判断页面是不是跨页传值

FindControl:获得控件的值

相关阅读 更多 +
排行榜 更多 +
汉房手机版

汉房手机版

生活实用 下载
瓜子二手车检瓜子评估检测系统

瓜子二手车检瓜子评估检测系统

生活实用 下载
电e宝

电e宝

生活实用 下载