如何在gridview里面的listview中使用multiselect [英] How to use multiselect in listview inside gridview

查看:47
本文介绍了如何在gridview里面的listview中使用multiselect的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai朋友,





我将sql table valus填充到listbox中。它位于< edititemtemplate>在gridview.Suppose如果我编辑一行然后我试图在列表框中选择多个选项。它不是在gridview中更新多个值。它只更新第一个选定的值。如何解决这个问题.Plz建议解决方案这个。



ListBox3从sql table填充值.Below是代码



Hai friends,


I am populating sql table valus into listbox.It is in the <edititemtemplate> in the gridview.Suppose If I edit a row then i tried to select multiple option in list box.It is not updating multiple values in gridview.It is updating only the first selected value.How can I resolve this.Plz suggest the solutions for this.

ListBox3 is populating values from sql table.Below is the code

<asp:TemplateField HeaderText="ImpactedEntity">
  <ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("ImpactedEntity") %>'></asp:Label>
  </ItemTemplate>
  <EditItemTemplate>
      <asp:ListBox ID="ListBox3" runat="server" AutoPostBack="True" SelectionMode="Multiple"></asp:ListBox>
  </EditItemTemplate>

  </asp:TemplateField>

推荐答案

HI

在GridView1_RowUpdating



尝试获取Listbox

ListBox lstBox =(ListBox)GridView1.Rows [e.RowIndex] .Cells [7] .Controls [0];



并在更新命令中更新数据时传递lstBox值



尝试这可能会帮助你
HI
In GridView1_RowUpdating

try to get Listbox
ListBox lstBox= (ListBox)GridView1.Rows[e.RowIndex].Cells[7].Controls[0];

and pass that lstBox value while updateing the data in update command

try this may it will helps you


这篇关于如何在gridview里面的listview中使用multiselect的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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