Edit this page

Binding to DataTable

RadDropDownList can be bound to a DataTable, DataSet, and DataView. The following example shows binding to a DataTable object.

The declaration of RadDropDownList object includes no DataSourceID property or <items> section:

<telerik:RadDropDownList RenderMode="Lightweight" ID="RadDropDownList1" runat="server">

In the Page_Load event handler, create and fill the DataTable object, then bind it to the RadDropDownList. The DataBind method must be called after setting the DataSource property.

protected void Page_Load(object sender, EventArgs e)
    if (!Page.IsPostBack)


private void BindToDataTable(Telerik.Web.UI.RadDropDownList dropdownlist)
    SqlConnection con = new SqlConnection("Data Source=LOCAL;Initial Catalog=DropDownList;Integrated Security=True");

    SqlDataAdapter adapter = new SqlDataAdapter("SELECT [Text], [Value] FROM [Links]", con);
    DataTable links = new DataTable();


    dropdownlist.DataTextField = "Text";
    dropdownlist.DataValueField = "Value";
    dropdownlist.DataSource = links;

Protected Sub Page_Load(sender As Object, e As EventArgs)
    If Not Page.IsPostBack Then
    End If

End Sub

Private Sub BindToDataTable(dropdownlist As Telerik.Web.UI.RadDropDownList)
    Dim con As New SqlConnection("Data Source=LOCAL;Initial Catalog=DropDownList;Integrated Security=True")

    Dim adapter As New SqlDataAdapter("SELECT [Text], [Value] FROM [Links]", con)
    Dim links As New DataTable()


    dropdownlist.DataTextField = "Text"
    dropdownlist.DataValueField = "Value"
    dropdownlist.DataSource = links
End Sub
Is this article helpful? No Yes
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article