【问题标题】:find out which control triggered postback找出哪个控件触发了回发
【发布时间】:2012-07-03 14:54:49
【问题描述】:

我有一个 aspx 网站,其中有多个用户控件。我想知道哪个控件(按钮、下拉菜单、单选按钮)从这些用户控件触发了回发。 我怎么能做到这一点。 在此先感谢 Laziale

【问题讨论】:

    标签: c# asp.net visual-studio-2010 user-controls


    【解决方案1】:

    来自: http://ryanfarley.com/blog/archive/2005/03/11/1886.aspx

    string ctrlname = page.Request.Params.Get("__EVENTTARGET");
    if (ctrlname != null && ctrlname != string.Empty)
    {
        return this.Page.FindControl(ctrlname);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-10-11
      • 1970-01-01
      • 2023-03-06
      • 2011-04-24
      • 2020-06-19
      • 1970-01-01
      • 2012-10-01
      相关资源
      最近更新 更多