New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Bind to Declarative DataSource

  • Demo Configurator
Declarative DataSourcesSql DataSource

RadRadioButtonList can be bound declaratively to any linear data source. In the current example you can configure the control to use 4 popular data source controls:

  • EntityDataSource
  • ObjectDataSource
  • SqlDataSource
  • XmlDataSource
  • DefaultCS.aspx
  • DefaultCS.aspx.cs
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.Web.Examples.RadioButtonList.Configurator.DefaultCS" %>

<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="ConfigurationPanel1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadioButtonList1" />
                    <telerik:AjaxUpdatedControl ControlID="ConfigurationPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>

    <div class="demo-container size-wide">
        <telerik:RadRadioButtonList runat="server" ID="RadioButtonList1" AutoPostBack="false" DataSourceID="SqlDataSource1">
            <Databindings DataTextField="Description" DataValueField="CategoryID" />
        </telerik:RadRadioButtonList>
    </div>

    <asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=NorthwindReadWriteEntities"
        DefaultContainerName="NorthwindReadWriteEntities" EntitySetName="Categories" Select="it.[CategoryID], it.[Description]"
        AutoPage="true" />
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" TypeName="Telerik.Web.Examples.Movie"
        SelectMethod="GetMovieList"></asp:ObjectDataSource>
    <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
        ProviderName="System.Data.SqlClient" SelectCommand="SELECT [CategoryID], [Description] FROM [Categories]" />
    <asp:XmlDataSource runat="server" ID="XmlDataSource1" DataFile="~/App_Data/ChartData.xml" />

    <qsf:ConfiguratorPanel runat="server" ID="ConfigurationPanel1">
        <Views>
            <qsf:View ID="View1" runat="server">
                <qsf:DropDownList runat="server" ID="DataSources" AutoPostBack="true" Label="Declarative DataSources" Size="Wide">
                    <Items>
                        <telerik:DropDownListItem Value="entity" Text="Entity DataSource" />
                        <telerik:DropDownListItem Value="obj" Text="Object DataSource" />
                        <telerik:DropDownListItem Value="sql" Text="Sql DataSource" Selected="true" />
                        <telerik:DropDownListItem Value="xml" Text="Xml DataSource" />
                    </Items>
                    </qsf:DropDownList>
            </qsf:View>
        </Views>
    </qsf:ConfiguratorPanel>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance