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

How to fill other columns by selecting some value in a drop down column

3 Answers 35 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Anahita
Top achievements
Rank 1
Anahita asked on 01 Mar 2015, 04:19 PM
hello everyone, i have a problem, i have a product table in Database, i need to automatically fill other columns by selecting product code value in my combo box column in my dataview but i cant do it, please help me, i already tried CellEndEdit event but i just got the productId that i need.

3 Answers, 1 is accepted

Sort by
0
Anahita
Top achievements
Rank 1
answered on 01 Mar 2015, 05:00 PM
for the record other columns are text box columns
0
Stefan
Telerik team
answered on 02 Mar 2015, 11:10 AM
Hello Anahita,

Thank you for writing.

A suitable event for the purpose would be CellValueChanged, which will get triggered once cell value is changed and submitted to the cell.

Another possible way is to use ValueChanged event, which will get triggered when the value of the cell is changed, even not yet submitted to the cell.

Here you can see the event sequence: http://www.telerik.com/help/winforms/gridview-editors-events.html.

I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.

Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Martin Hamilton
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 06 Mar 2015, 12:26 PM
Private Sub rgvDispenseProducts_CellValueChanged(sender As Object, e As GridViewCellEventArgs)
    If TypeOf e.Column Is GridViewComboBoxColumn Then
            oSQL = New DAL.SQLServer
            oSQL.ConnectionString = cnSQL
            Dim dtProducts As DataTable = oSQL.GetDataTable("Select * From Products where id = " & e.Value)
                        For Each myRow As DataRow In dtProducts.Rows
                                    rgvDispenseProducts.SelectedRows(0).Cells("ProductName").Value = myRow("ProductName").ToString
                        Next
            End If
End Sub
Tags
GridView
Asked by
Anahita
Top achievements
Rank 1
Answers by
Anahita
Top achievements
Rank 1
Stefan
Telerik team
Martin Hamilton
Top achievements
Rank 1
Iron
Iron
Veteran
Share this question
or