zoukankan      html  css  js  c++  java
  • 触发Repeater中的Dropdownlist的SelectedIndexChanged如何获得Repeater的当前行

     <asp:Repeater ID="rptUserList" runat="server" OnItemCommand="rptUserList_ItemCommand">
      <ItemTemplate>
        <tr>
          <td>
              <asp:CheckBox ID="chkDel" runat="server" />
            </td>                                                             
            <td style="word-break: break-all" align="center">
                <asp:Literal runat="server" ID="ltlId" Text=' <%#Eval("Id")%>' Visible="false"> </asp:Literal>         
                <%# Eval("UserName")%>
            </td>         
            <td>
              <asp:DropDownList ID="ddlRole" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlRole_SelectedIndexChanged"> </asp:DropDownList>                    </td>                       
                           

    --------------------------------------------------------------


    protected void ddlRole_SelectedIndexChanged(object sender, EventArgs e)
        {
          // Response.Write(((DropDownList)sender).SelectedValue);

            DropDownList ddlRole = (DropDownList)sender;
            int roleId = Convert.ToInt32(ddlRole.SelectedValue);

            Repeater rptUserList = ddlRole.Parent.Parent as Repeater;
            int n = ((RepeaterItem)ddlRole.Parent).ItemIndex;       
            int Id = Convert.ToInt32(((Literal)(rptUserList.Items[n].FindControl("ltlId"))).Text);

         
            //....下面写进数据库操作
          //....
           
        }

  • 相关阅读:
    Python 多核 多线程 调度
    mysql-select for update
    Python logging模块
    TCP/IP和HTTP协议与Socket的区别联系
    DNS+CDN
    wget命令
    Cannot find module 'webpack-cli/bin/config-yargs
    TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'
    js 创建私有变量
    报错集锦及解决方案
  • 原文地址:https://www.cnblogs.com/gdjlc/p/2086945.html
Copyright © 2011-2022 走看看