我试过但它不起作用 [英] i tried but it is not working

查看:68
本文介绍了我试过但它不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在显示从gridview到列表框的gridview选定行值



我的代码如下



I am showing gridview selected rows values from gridview to listbox

My code as follows

protected void gvPkgcbndate_SelectedIndexChanged1(object sender, EventArgs e)
  {

lbllist.Items.Add(gvPkgcbndate.SelectedRow.Cells[0].Text.ToString() + "" + gvPkgcbndate.SelectedRow.Cells[1].Text.ToString());

  }







源代码如下




Source code as follows

<columns>
     <asp:TemplateField>
      <itemtemplate>
          <asp:ButtonField Text="Click Here" CommandName="Select";
<columns>



在运行模式下如下




in run mode as follows

Selectbutton (header)             Available seats

      clickhere (Button)               27 may 2015
      clickhere (butotn)               30 may 2015





当用户选择gridview行数据(所有行)时,我想显示列表框中的所有选定行



但是当用户选择第一行时我的上面的代码和第二排。

只有第二行最后选择的行详细信息才显示在列表框中。



wha是我上面代码中的问题。



When user selects gridview row data (all the rows) i want to display all the selected rows in listbox

But my above code when user select the first row and second row.
only second row last selected row details only displayed in the listbox.

wha is the problem in my above code.

推荐答案

GridView控件在选择标准上有一定的限制。



这是一篇很棒的文章来帮助你完成多个工作选定的行:



如何在ASP.Net中从GridView获取多个选定的行 [ ^ ]
The GridView control is somewhat limited in the selection criteria.

Here is a great article to help work through multiple selected rows:

How To Get Multiple Selected Rows From GridView In ASP.Net[^]


这篇关于我试过但它不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆