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.
Unfortunately, activation email could not send to your email. Please try again.

How to update a column for multiple row selections

Thread ID:

Created:

Updated:

Platform:

Replies:

26389 Mar 22,2005 10:25 AM Mar 22,2005 01:16 PM Windows Forms 1
loading
Tags: GridControl
Tom van de Kerkhof
Asked On March 22, 2005 10:25 AM

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

Administrator [Syncfusion]
Replied On March 22, 2005 01:16 PM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;