This is a migrated thread and some comments may be shown as answers.

MulticolumunDropdown in Gridview

1 Answer 43 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 21 Nov 2008, 12:03 PM
Hi can anyone help with this issue with gridview.

I have a gridview and the first column has been convert to the mutlicolumn dropdown. Then when i add a new row the gridview i want transfer the data from that row in the multicolumngridview dropdown to the gridview.

Hope someone can help, i am vb.net

Cheers

T

1 Answer, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 25 Nov 2008, 03:53 PM
Hello Tim,

Thank you for writing.

RadGridView does not support the described scenario out of the box, but you could implement custom logic to achieve your needs. For example, you can use RowsChanged and CurrentRowChanged events to retrieve the new row values, and add them to the DataSource of the GridViewMultiColumnComboBoxColumn. Please, review the code fragment below as example (in VB):
 
Private addedNewTbl As DataTable   
Private lastAddedRow As GridViewDataRowInfo   
 
Private Sub InitializeTable()   
    Me.addedNewTbl = Me.nwindDataSet.Products.Clone()   
    Me.addedNewTbl.Clear()   
End Sub   
 
Private Sub radGridView1_RowsChanged(ByVal sender As ObjectByVal e As GridViewCollectionChangedEventArgs)   
    'determine if added new row   
    If e.Action = Telerik.WinControls.Data.NotifyCollectionChangedAction.Add Then   
        lastAddedRow = DirectCast(e.NewItems(0), GridViewDataRowInfo)   
    End If   
End Sub   
 
Private Sub radGridView1_CurrentRowChanged(ByVal sender As ObjectByVal e As CurrentRowChangedEventArgs)   
    'finish adding new row   
    If TypeOf e.OldRow Is GridViewNewRowInfo AndAlso Me.radGridView1.Rows.IndexOf(Me.lastAddedRow) >= 0 Then   
        Try   
            Me.addedNewTbl.Rows.Add(Me.lastAddedRow.Cells(1).Value, Me.lastAddedRow.Cells(2).Value, Me.lastAddedRow.Cells(3).Value, Me.lastAddedRow.Cells(5).Value, Me.lastAddedRow.Cells(6).Value)   
        Finally   
            Me.lastAddedRow = Nothing   
        End Try   
    End If   
End Sub  

Also I have attached a working example project (written in C#) to this message.

Hope, this helps, if you have other questions, do not hesitate to contact me again.

 
Greetings,
Martin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Tim
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Share this question
or