• Repeater控件中点击按钮后获取某一行的数据


    前台

    <tr>
    <td style="50px"><%# Container.ItemIndex + 1+(Convert.ToInt32(this.drpCurrentPageIndex.SelectedValue)-1)*Convert.ToInt32(this.drpCount.SelectedValue)%></td>
    <td>
    <asp:Label ID="lbQuestionTypesName" runat="server" Text='<%# Eval("QuestionTypesName")%>'></asp:Label>
    <asp:HiddenField ID="hfQuestionTypesID" Value='<%# Eval("QuestionTypesID")%>' runat="server" />
    </td>
    <td>
    <asp:Label ID="lbStageName" runat="server" Text='<%# Eval("Name") %>'></asp:Label>
    <asp:HiddenField ID="hfStageID" Value='<%# Eval("StageID") %>' runat="server" />
    </td>
    <td>
    <asp:Label ID="lbGradeName" runat="server" Text='<%# Eval("GradeName") %>'></asp:Label>
    <asp:HiddenField ID="hfGradeID" Value='<%# Eval("GradeID") %>' runat="server" />
    </td>
    <td>
    <asp:Label ID="lbSemesterID" runat="server" Text='<%# Eval("SemesterID").ToString()=="0"?"上学期":"下学期" %>'></asp:Label>
    <asp:HiddenField ID="hfSemesterID" Value='<%# Eval("SemesterID") %>' runat="server" />
    </td>
    <td>
    <asp:DropDownList ID="drpStatu" runat="server" AutoPostBack="true" OnSelectedIndexChanged="drpStatu_SelectedIndexChanged">
    <asp:ListItem Value="0">未开放</asp:ListItem>
    <asp:ListItem Value="1">开放</asp:ListItem>
    </asp:DropDownList>
    </td>
    </tr>

    后台


    DropDownList ddl = (DropDownList)sender;
    RepeaterItem ri = (RepeaterItem)ddl.NamingContainer;
    string sQuestionTypesID = ((HiddenField)ri.FindControl("hfQuestionTypesID")).Value;
    string sStageID = ((HiddenField)ri.FindControl("hfStageID")).Value;
    string sGradeID = ((HiddenField)ri.FindControl("hfGradeID")).Value;
    string sSemesterID = ((HiddenField)ri.FindControl("hfSemesterID")).Value;
    bool bstatus = ddl.SelectedValue == "1" ? true : false;

  • 相关阅读:
    百度地图API地理位置和坐标转换
    WebClient 通过get和post请求api
    C#模拟POST提交表单(二)--HttpWebRequest以及HttpWebResponse
    C#模拟POST提交表单(一)--WebClient
    百度外卖接口调试 C#版
    DWZ(JUI) 教程 跨域请求 iframeNavTab
    订餐系统之同步美团商家订单
    订餐系统之同步饿了么商家订单
    外卖订单爬虫(美团,饿了么,百度外卖)
    订餐系统之获取淘宝外卖订单
  • 原文地址:https://www.cnblogs.com/liziqiang/p/3711552.html
Copyright © 2020-2023  润新知