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

How to select default value of combobox column

2 Answers 568 Views
GridView
This is a migrated thread and some comments may be shown as answers.
LEON
Top achievements
Rank 1
LEON asked on 12 Nov 2018, 08:58 PM

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"
07. 
08. 
09.'>>>>>Populate Radgridview "dgv_return". Data source "due_bill_detail" table
10.For Each row As DataRow In ds.Tables("due_bill_detail").Rows
11. 
12.Dim rowInfo As New GridViewDataRowInfo(dgv_return.MasterView)
13. 
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
17.dgv_return.Rows.Add(rowInfo)
18.Next row

 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 13 Nov 2018, 09:34 AM
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.

Regards,
Dimitar
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.
0
LEON
Top achievements
Rank 1
answered on 13 Nov 2018, 12:25 PM

@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.

Tags
GridView
Asked by
LEON
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
LEON
Top achievements
Rank 1
Share this question
or