How to select default value of combobox column

3 posts, 1 answers
  1. LEON
    LEON avatar
    13 posts
    Member since:
    Nov 2018

    Posted 12 Nov 2018 Link to this post

    In my Radgridview I have a combobox column with 3 predifined value.

    1. "No Change"

    2. "Partial Return"

    3. "Full Return"

    I want to set "No Change" as my default value. how can I do that?

    My existing code

    01.'>>>>>Create combobox column "status". Datasource "return_status" table
    02.Dim clm_status As New GridViewComboBoxColumn
    03.clm_status = CType(dgv_return.Columns("status"), GridViewComboBoxColumn)
    04.clm_status.DataSource = ds.Tables("return_status")
    05.clm_status.DisplayMember = "status_display"
    06.clm_status.ValueMember = "status_value"
    09.'>>>>>Populate Radgridview "dgv_return". Data source "due_bill_detail" table
    10.For Each row As DataRow In ds.Tables("due_bill_detail").Rows
    12.Dim rowInfo As New GridViewDataRowInfo(dgv_return.MasterView)
    14.rowInfo.Cells(dgv_return.Columns("status").Index).Value = "No Change"   'This is the combobox column. Its not working
    15.rowInfo.Cells(dgv_return.Columns("item_code").Index).Value = row("item_code") 'This is working fine
    16.rowInfo.Cells(dgv_return.Columns("item_name").Index).Value = row("item_name") 'This is working fine
    18.Next row



  2. Answer
    Dimitar avatar
    2892 posts

    Posted 13 Nov 2018 Link to this post

    Hello Leon,

    The ValueMember is set to "status_value" so you need to use a value that corresponds to a value in this field in your data table.

    I hope this will be useful. Let me know if you have additional questions.

    Progress Telerik
    Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. LEON
    LEON avatar
    13 posts
    Member since:
    Nov 2018

    Posted 13 Nov 2018 Link to this post

    @Dimitar OMG what a foolish mistake. Its clearly your experiance talked. I never says I set different value and display member.

    really appritiate the help.

Back to Top