且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在ASP.NET C#中重新识别动态生成的链接按钮单击事件

更新时间:2023-09-29 17:50:34

就像在page_load FbtnLink.Click +=new EventHandler(FbtnLink_Click);一样正常.

但是,当您执行跨页面发布时,请通过属性来访问此页面数据.所以如果你有

public string message { get; set; },然后在链接"按钮上单击

Just normal like at page_load FbtnLink.Click +=new EventHandler(FbtnLink_Click);.

But as you are doing a cross page posting make the accessibility of this page data through properties. So if you have

public string message { get; set; } then at Link button click

protected void FbtnLink_Click(object sender, EventArgs e)
{
    message = "Hello Page2 From Page1";
}



可以从其他页面访问此属性

在标记寄存器中,上一页的类型<%@ PreviousPageType VirtualPath="~/Default.aspx" %>

Response.Write(this.PreviousPage.message);.

您需要至少访问一次上一页才能运行click事件.这是有线的,但是有些奇怪的行为.

祝你好运



this property can be accessed from the other page

At the markup register the type of previous page <%@ PreviousPageType VirtualPath="~/Default.aspx" %>

Response.Write(this.PreviousPage.message); .

You need to access the previous page at least one time to get the click event run. This is wired but some strange behavior.

Good luck