久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <i id='XV1fK'><tr id='XV1fK'><dt id='XV1fK'><q id='XV1fK'><span id='XV1fK'><b id='XV1fK'><form id='XV1fK'><ins id='XV1fK'></ins><ul id='XV1fK'></ul><sub id='XV1fK'></sub></form><legend id='XV1fK'></legend><bdo id='XV1fK'><pre id='XV1fK'><center id='XV1fK'></center></pre></bdo></b><th id='XV1fK'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='XV1fK'><tfoot id='XV1fK'></tfoot><dl id='XV1fK'><fieldset id='XV1fK'></fieldset></dl></div>
    <legend id='XV1fK'><style id='XV1fK'><dir id='XV1fK'><q id='XV1fK'></q></dir></style></legend>

        <tfoot id='XV1fK'></tfoot>
          <bdo id='XV1fK'></bdo><ul id='XV1fK'></ul>
      1. <small id='XV1fK'></small><noframes id='XV1fK'>

        動態創建的 LinkBut??tons 的 OnClick 事件不起作用

        OnClick event of dynamically created LinkButtons is not working(動態創建的 LinkBut??tons 的 OnClick 事件不起作用)

        <small id='CrF4V'></small><noframes id='CrF4V'>

      2. <legend id='CrF4V'><style id='CrF4V'><dir id='CrF4V'><q id='CrF4V'></q></dir></style></legend>

          <bdo id='CrF4V'></bdo><ul id='CrF4V'></ul>
        • <i id='CrF4V'><tr id='CrF4V'><dt id='CrF4V'><q id='CrF4V'><span id='CrF4V'><b id='CrF4V'><form id='CrF4V'><ins id='CrF4V'></ins><ul id='CrF4V'></ul><sub id='CrF4V'></sub></form><legend id='CrF4V'></legend><bdo id='CrF4V'><pre id='CrF4V'><center id='CrF4V'></center></pre></bdo></b><th id='CrF4V'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='CrF4V'><tfoot id='CrF4V'></tfoot><dl id='CrF4V'><fieldset id='CrF4V'></fieldset></dl></div>
            <tfoot id='CrF4V'></tfoot>
              <tbody id='CrF4V'></tbody>

                  本文介紹了動態創建的 LinkBut??tons 的 OnClick 事件不起作用的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我嘗試了多種解決方案來解決這個問題,但都沒有奏效.基本上,我有一張員工表,用戶可以選擇通過更新面板動態添加員工.每個員工都被添加為 LinkBut??ton,此按鈕將通過 ajaxToolkit:modalpopupextender 窗口>OnClick 事件,此窗口將顯示員工詳細信息.問題是當我點擊員工姓名時,彈出窗口會顯示細節不會.

                  I’ve tried several solutions for this problem but none of them worked. Basically, I have a table of employees and the user have the choice of adding an employee dynamically thru an update panel. Each employee is being added as LinkButton and this button will fire ajaxToolkit:modalpopupextender window through OnClick event, and this window will show the employee details. The problem is when I click on the employee name the popup window will show up BUT the details wont.

                  這是我創建按鈕并將其放入表格的代碼:

                  Here is the code in which I’m creating the buttons and putting it in the table:

                  LinkButton lbtn = new LinkButton();
                                      lbtn.ID = employee_arry[i] + "_lbtn" + i;
                                      lbtn.Text = employee_arry[i];
                                      lbtn.Click += new EventHandler(this.employee_info);
                                      lbtn.CausesValidation = false;
                                      lbtn.Attributes.Add("runat", "server");
                                      cell.Controls.Add(lbtn);
                  

                  這里是employee_info方法:

                  and here is the employee_info method:

                  //the info will be pulled from the database…
                  public void employee_info(object sender, EventArgs e)
                      { 
                          name.Text = "employee name";
                          dept.Text = "employee department";
                          jobt.Text = "employee job title";
                          email.Text = "employee email";
                          tel.Text = "employee telephone";
                          ModalPopupExtender1.Show();
                      }
                  

                  推薦答案

                  查看這個答案

                  https://stackoverflow.com/a/11127064/1268570

                  這解釋了動態控件的行為

                  This explains the behavior of dynamic controls

                  你需要考慮:

                  • 當您不使用母版頁時,應在 PreInit 事件中創建動態控件,如果是,則在 Init 事件中創建控件
                  • 避免在這些事件中設置可以在每個帖子中更改的屬性,因為當應用視圖狀態時(在帖子事件中),這些屬性將被覆蓋
                  • 每次發布??頁面時都必須創建動態控件,避免這種情況 if(!this.IsPostBack) this.CreatemyDynamicControls();
                  • 當您在 PreInit 或 Init 事件中創建控件時,它們的狀態將在 post 事件中自動設置,這意味著在 LoadComplete 事件中,即使您在每個 post 中再次創建控件,您的控件也會包含它們的狀態,甚至當您沒有明確設置它們的狀態時.請注意,當您處理在設計時創建的控件時,此行為是不同的,在這種情況下,設置狀態的事件是 Load 事件
                  • 事件訂閱應該在 PageLoadComplete 之前發生,否則它們將不會被引發

                  如果您還沒有找到解決方案,這是一種方法(完整的工作示例):

                  In case you have not found a solution, this is a way to do it (full working example):

                      <asp:ScriptManager runat="server" />
                      <asp:UpdatePanel ID="UpdatePanel1" runat="server" ViewStateMode="Enabled">
                          <ContentTemplate>
                              <asp:Panel runat="server" ID="myPanel">
                              </asp:Panel><br />
                              <asp:Button ID="Button1" Text="add control" runat="server" OnClick="addControl_Click" /><br />
                              <asp:Label ID="lblMessage" runat="server" />
                          </ContentTemplate>
                      </asp:UpdatePanel>
                  

                  代碼隱藏

                      protected int NumberOfControls
                      {
                          get
                          {
                              if (ViewState["c"] == null)
                              {
                                  return 0;
                              }
                  
                              return int.Parse(ViewState["c"].ToString());
                          }
                          set
                          {
                              ViewState["c"] = value;
                          }
                      }
                  
                      protected void addControl_Click(object sender, EventArgs e)
                      {
                          this.NumberOfControls++;
                          this.myPanel.Controls.Add(new Literal { Text = "<br />" });
                          this.myPanel.Controls.Add(this.CreateLinkButton(this.NumberOfControls));
                      }
                  
                      protected void Page_PreLoad(object sender, EventArgs e)
                      {
                          this.CreateDynamicLinkButtons();
                      }
                  
                      private void CreateDynamicLinkButtons()
                      {
                          for (int i = 0; i < this.NumberOfControls; i++)
                          {
                              this.myPanel.Controls.Add(new Literal { Text = "<br />" });
                              this.myPanel.Controls.Add(this.CreateLinkButton(i + 1));
                          }
                      }
                  
                      private LinkButton CreateLinkButton(int index)
                      {
                          var l = new LinkButton { Text = "MyLink" + index.ToString(), ID = "myLinkID" + index.ToString() };
                          l.Click += (x, y) =>
                          {
                              this.lblMessage.Text += "<br/>ID: " + (x as LinkButton).ID;
                          };
                  
                          return l;
                      }
                  

                  輸出

                  這篇關于動態創建的 LinkBut??tons 的 OnClick 事件不起作用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  onClick event for Image in Unity(Unity中圖像的onClick事件)
                  Running Total C#(運行總 C#)
                  Deleting a directory when clicked on a hyperlink with JAvascript.ASP.NET C#(單擊帶有 JAvascript.ASP.NET C# 的超鏈接時刪除目錄)
                  asp.net listview highlight row on click(asp.net listview 在單擊時突出顯示行)
                  Calling A Button OnClick from a function(從函數調用按鈕 OnClick)
                  ASP.net C# Gridview ButtonField onclick event(ASP.net C# Gridview ButtonField onclick 事件)
                  <tfoot id='IGWLk'></tfoot>
                    <tbody id='IGWLk'></tbody>
                    • <small id='IGWLk'></small><noframes id='IGWLk'>

                        <bdo id='IGWLk'></bdo><ul id='IGWLk'></ul>

                        1. <legend id='IGWLk'><style id='IGWLk'><dir id='IGWLk'><q id='IGWLk'></q></dir></style></legend>

                            <i id='IGWLk'><tr id='IGWLk'><dt id='IGWLk'><q id='IGWLk'><span id='IGWLk'><b id='IGWLk'><form id='IGWLk'><ins id='IGWLk'></ins><ul id='IGWLk'></ul><sub id='IGWLk'></sub></form><legend id='IGWLk'></legend><bdo id='IGWLk'><pre id='IGWLk'><center id='IGWLk'></center></pre></bdo></b><th id='IGWLk'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='IGWLk'><tfoot id='IGWLk'></tfoot><dl id='IGWLk'><fieldset id='IGWLk'></fieldset></dl></div>
                            主站蜘蛛池模板: 国产欧美日韩综合 | 午夜视频免费观看 | 亚洲一区视频 | 色妞网| 毛片毛片毛片毛片毛片毛片 | 一区二区三区亚洲 | 国产成人精品三级麻豆 | 九九香蕉视频 | 日日夜夜精品免费 | 精品国产区一区二 | 日本色网址 | 久久国产精品一区二区 | 久久久久久综合 | 国产成人免费在线视频 | 伦一理一级一a一片 | 精品一二三区 | 欧美激情亚洲 | 欧美成人毛片 | 99在线免费观看 | 国产亚洲视频在线观看 | 自拍视频一区 | 欧美一区视频 | 日本特级淫片 | 国产综合久久久 | 日韩中文在线观看 | 亚洲最新视频 | 国产一区免费 | 免费国产视频 | 日韩视频一区二区三区 | 午夜aaa | 欧美精品亚洲精品 | 美日韩在线视频 | 日韩一级免费视频 | 午夜视频免费观看 | 亚洲成人免费在线 | 黄在线观看 | 欧美一级全黄 | 日韩中文字幕在线观看 | 国产逼逼| 99久久久国产精品 | 成人毛片在线观看 |