Click here to Skip to main content
15,896,429 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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>
Posted

1 solution

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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900