We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to update a column for multiple row selections

Hi, I want to update a column in my griddataboundgrid with a specific value. (the underlying datasource) But the problem is that I have multiselection on. So I need to update the number of rows selected. I took a look in the knowledge base examples: Dim cm As CurrencyManager = CType(Me.BindingContext(Me.gridDataBoundGrid1.DataSource), CurrencyManager) Dim dr As DataRowView = CType(cm.Current, DataRowView) Console.WriteLine((dr("Column").ToString())) But this is for the current selected row only. Is there a solution for this? Thanks a lot! Greetz, Tom

1 Reply

AD Administrator Syncfusion Team March 22, 2005 06:16 PM UTC

I assume you have ListBoxSelectionMode set, and you want to loop through the selected rows in teh grid, and display the display some values from the DataSource. If so, here is code to try:
Dim cm As CurrencyManager = CType(Me.BindingContext(Me.gridDataBoundGrid1.DataSource), CurrencyManager)
Dim dr As DataRowView
Dim range As GridRangeInfo
For Each range In  Me.gridDataBoundGrid1.Selections.GetSelectedRows(True, False)
   Dim row As Integer
   For row = range.Top To range.Bottom
      Dim pos As Integer = Me.gridDataBoundGrid1.Binder.RowIndexToPosition(row)
      dr =CType( cm.List(pos), DataRowView)
      Console.WriteLine(dr("Column"))
   Next row
Next range

Loader.
Live Chat Icon For mobile
Up arrow icon