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

Radcombobox Class

2 Answers 25 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
khansa
Top achievements
Rank 1
khansa asked on 23 Jul 2010, 08:46 AM
Hi All.

I always used class for RadComboBox to fetch the record from database..
----------------------------------------------
Public Sub BindRadcombobox(ByVal objcombobox As RadComboBox, ByVal sqlstr As String, ByVal fieldname As String, ByVal fieldvalue As String)

        ds = New DataSet()
        ds = bindDataSet(sqlstr)
        If ds.Tables(0).Rows.Count > 0 Then
            For Each dsrow As DataRow In ds.Tables(0).Rows
                objcombobox.Items.Add(Convert.ToString(dsrow(fieldname)))
// Error is coming here ((" Value Type 'String' cannot be converted to Telerik.Web.UI.RadComboBoxItem")
                objcombobox.Items(objcombobox.Items.Count - 1).Value = Convert.ToString(dsrow(fieldvalue))
            Next

        End If
    End Sub
----------------------------------------
    void color()
    {
        conquery dq = new conquery();
        string strsql;
        strsql = "select * from color";

        dq.BindRadcombobox(RadComboBox1, strsql, "color", "clid");
    }
------------------------------------
But it is giving errror that (" Value Type 'String' cannot be converted to Telerik.Web.UI.RadComboBoxItem")

But my this code works with normal DropDownList.

Please assist.

Thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 23 Jul 2010, 11:22 AM
Hello khansa,

You should create a RadComboBoxItem and add it to the Items collection of the combobox as described here.

Greetings,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
khansa
Top achievements
Rank 1
answered on 26 Jul 2010, 10:18 PM
Thank you so much.
It is working now.
Tags
General Discussions
Asked by
khansa
Top achievements
Rank 1
Answers by
Yana
Telerik team
khansa
Top achievements
Rank 1
Share this question
or