troubleshooting Question

C# getting values from a listbox inside a gridview

Avatar of national_fulfillment
national_fulfillmentFlag for United States of America asked on
.NET ProgrammingASP.NET
3 Comments1 Solution1289 ViewsLast Modified:
i have a listbox in a grid and i'm trying to access the values populated in the listbox during the row updating event.  
<ItemTemplate>
 <asp:ListBox ID="InsuranceLB" runat="server" Width="225px" Height="75px" SelectionMode="Multiple" style="margin-top:2px;" autoscroll="true"  /><br />
</ItemTemplate>
     <ItemStyle VerticalAlign="Top" />
 </asp:TemplateField>

This is how i'm trying to get the values
   ListBox myListBox = (ListBox)GridView1.Rows[e.RowIndex].Cells[14].FindControl("InsuranceLB");
       
An error isn't thrown but i don't get the listbox values either. Any direction would be appreciated. Thanks in advance.
ASKER CERTIFIED SOLUTION
Gerry Bartley
Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros