代码之家  ›  专栏  ›  技术社区  ›  SANDEEP

如何在一个查询字符串中传递多个值?

  •  1
  • SANDEEP  · 技术社区  · 13 年前

    我有一个网格。网格中有多个值。假设网格中有候选Id列,并且每行都有复选框。我想通过复选框选择候选Id的多个值,并将单个查询字符串中的多个选定值传递给另一个页面。传递后,我将使用 split() 函数并保持在数组中。因为我必须使用这个多个候选id在目标页面上执行一些操作。请给我一些解决这个问题的办法。

    这是我的格子。 我没有在这个代码中包含复选框

    <asp:GridView ID="grdReq" runat="server" AutoGenerateColumns="false"    CssClass="SimpleGrid" OnRowDataBound="grdReq_RowDataBound">
    <Columns>
      <asp:BoundField DataField="CandidateID" HeaderText="Candidate Id" />
      <asp:BoundField DataField="Candidate Name" HeaderText="Candidate Name" />
      <asp:BoundField DataField="Current Organization" HeaderText="Current Organization" />
      <asp:BoundField DataField="Current Designation" HeaderText="Current Designation" />
      <asp:BoundField DataField="Overall Exp" HeaderText="Overall Exp" />
      <asp:BoundField DataField="Qualification" HeaderText="Qualification" />
    </Columns>
    </asp:GridView>
    
    1 回复  |  直到 13 年前
        1
  •  2
  •   zeeshan    13 年前

    好吧,我在不久的过去做过这样的事情,程序是:

    1. 循环浏览页面以查找复选框,并添加那些被选中的复选框,如字符串生成器:
              StringBuilder sb = new StringBuilder();
    
               sb.Append(yourcheckbox);
                sb.Append(",");
    

    在接收时,您可以使用“,”将其拆分,并且您将拥有所有复选框。

    祝你好运

    推荐文章