久久久久久久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'>

        動(dòng)態(tài)創(chuàng)建的 LinkBut??tons 的 OnClick 事件不起作用

        OnClick event of dynamically created LinkButtons is not working(動(dòng)態(tài)創(chuàng)建的 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>

                  本文介紹了動(dòng)態(tài)創(chuàng)建的 LinkBut??tons 的 OnClick 事件不起作用的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時(shí)送ChatGPT賬號(hào)..

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

                  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.

                  這是我創(chuàng)建按鈕并將其放入表格的代碼:

                  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();
                      }
                  

                  推薦答案

                  查看這個(gè)答案

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

                  這解釋了動(dòng)態(tài)控件的行為

                  This explains the behavior of dynamic controls

                  你需要考慮:

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

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

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

                  輸出

                  這篇關(guān)于動(dòng)態(tài)創(chuàng)建的 LinkBut??tons 的 OnClick 事件不起作用的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  onClick event for Image in Unity(Unity中圖像的onClick事件)
                  Running Total C#(運(yùn)行總 C#)
                  Deleting a directory when clicked on a hyperlink with JAvascript.ASP.NET C#(單擊帶有 JAvascript.ASP.NET C# 的超鏈接時(shí)刪除目錄)
                  asp.net listview highlight row on click(asp.net listview 在單擊時(shí)突出顯示行)
                  Calling A Button OnClick from a function(從函數(shù)調(diào)用按鈕 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>
                            主站蜘蛛池模板: 亚洲福利视频一区二区 | 成人影 | 亚洲国产成人精品女人久久久 | 中文字幕在线视频免费观看 | 亚洲毛片在线观看 | 3级毛片| 一区二区三区国产 | 欧美日韩成人一区二区 | 欧美另类视频 | 久久一区二区视频 | av一区在线| 久久五月婷 | 99精品99| 97色伦网 | 中文字幕在线播放第一页 | av久久 | 中文字幕一区二区三区不卡在线 | 午夜久久久久久久久久一区二区 | 羞羞视频在线观看免费观看 | 特级做a爰片毛片免费看108 | 欧美激情在线精品一区二区三区 | 久久精品一二三影院 | 日韩精品一区二区三区中文在线 | 精品一级 | 999观看免费高清www | 国产欧美日韩综合精品一区二区 | 日韩精品一区二区三区免费视频 | 黄色免费av | 精品久久一区二区三区 | 久久九七 | 91麻豆精品国产91久久久久久久久 | 91精品国产综合久久久动漫日韩 | www.午夜| 二区在线观看 | 久久久久国产精品 | 欧美videosex性极品hd | 欧美一级二级三级视频 | 91免费高清 | 一区在线播放 | 在线欧美| 拍真实国产伦偷精品 |