为什么onserverclick在asp.net中的href中不起作用

时间:2015-10-14 17:03:38

标签: asp.net href

我有问题,onserverclick属性不起作用,分配给它的方法不会触发。

    string strTr = "";
      for (int i = 0; i < adminuserlist.Count; i++)
        {
          strTr += string.Format("<tr id=\"tr\">" +
                                          "  <td>{0}</td> " +
                                          "  <td>{1}</td> " +
                                          "  <td>{2}</td> " +
                                          "  <td>{3}</td> " +
                                          "  <td>{4}</td> " +
                                          "  <td>{5}</td> " +
                                          "  <td>{6}</td> " +
                                          "<td class=\"col-lg-2\">" +
                                          " <a href=\"#\" id=" + i + 
              "runat=\"server\" onServerClick=\"MyFuncion_Click\"    
             class=\"table-icontoolbar\" data-toggle=\"tooltip\" data-
             placement=\"top\" title=\"Edit\"> " +
                                          "          <img         
                               src=\"../images/icon-edit.png\"></a> " +
                                          "      <a href=\"#\"  
             runat=\"server\" onClick=\"bll();\"  
            onServerClick=\"MyFuncion_Click2\" class=\"table-icontoolbar\" 
            data-toggle=\"tooltip\" data-placement=\"top\"  
               title=\"Delete\">" +
                                          "          <img 
               src=\"../images/icon-delete.png\"></a>" +
                                          "  </td> " +
                                          " </tr>",   
          adminuserlist[i].AdminUserName, 
           adminuserlist[i].AdminUserPassword,
                                          adminuserlist[i].AdminUserEmail, 
              adminuserlist[i].AdminUserType, adminuserlist[i].IsActive,
                                          adminuserlist[i].isDeleted,      
                adminuserlist[i].CreatedOn);

tbodyAdminUserView.InnerHtml = strTr;
}

这是应该触发的功能:

  public void MyFuncion_Click(Object sender, EventArgs e)
   {           
        Label1.Text = "vvvv";
   }

0 个答案:

没有答案