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

4 posts, 0 answers
  1. Anahita
    Anahita avatar
    2 posts
    Member since:
    Mar 2015

    Posted 01 Mar 2015 Link to this post

    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.
  2. Anahita
    Anahita avatar
    2 posts
    Member since:
    Mar 2015

    Posted 01 Mar 2015 in reply to Anahita Link to this post

    for the record other columns are text box columns
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 02 Mar 2015 Link to this post

    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.

     
  5. Martin Hamilton
    Martin Hamilton avatar
    18 posts
    Member since:
    Aug 2009

    Posted 06 Mar 2015 in reply to Anahita Link to this post

    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
Back to Top