久久久久久久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)您不使用母版頁(yè)時(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ā)布??頁(yè)面時(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>
                            主站蜘蛛池模板: 国产a区| 国产人成精品一区二区三 | 毛片在线视频 | 国产成人精品区一区二区不卡 | 国产精品视频一二三区 | 亚洲一二三区精品 | 欧美美女爱爱视频 | 一区二区三区av | 久久久久久免费毛片精品 | 欧美日韩亚洲国产 | 国产蜜臀97一区二区三区 | 91九色麻豆 | 午夜av免费 | 久久一区二区三区四区 | 久久九九免费 | 亚洲国产精品网站 | 正在播放国产精品 | 久久久高清 | 日韩精品在线看 | 精品一区二区三区中文字幕 | 国产精品一区二区三区久久久 | 91视频大全 | 黄色国产在线视频 | 一呦二呦三呦国产精品 | 色婷婷激情综合 | 日韩欧美久久精品 | 亚洲欧洲在线观看视频 | 黄网站免费在线看 | 亚洲视频一 | 日韩成人中文字幕 | 久久久久久久久久一区 | 中文字幕高清在线 | www.四虎.com| 欧美精品一区久久 | 精品视频一区二区三区在线观看 | 久久99精品国产 | 中文字幕在线看 | 日韩成人av在线 | 一区在线观看 | 亚洲人在线 | 久久久久久成人 |