telerik dropdownlist

8 posts, 1 answers
  1. Santosh
    Santosh avatar
    24 posts
    Member since:
    Sep 2013

    Posted 19 Oct 2013 Link to this post

    how to get values  from database into telerik dropdownlist ????
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 21 Oct 2013 Link to this post

    Hi Santosh,

    Please have a look into the following code snippet to get values from database in RadDropDownList.

    ASPX:
    <telerik:RadDropDownList ID="RadDropDownList1" runat="server" DataSourceID="SqlDataSource1"
        DefaultMessage="select" DataTextField="Cityname">
    </telerik:RadDropDownList>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
        SelectCommand="SELECT [Cityname] FROM [City]">
    </asp:SqlDataSource>

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Santosh
    Santosh avatar
    24 posts
    Member since:
    Sep 2013

    Posted 22 Oct 2013 Link to this post

    Thanks for the reply ..... Actually we are getting the values from database through data binding but it is not showing the value in page load itself when we click on dropdownlist values are present but by default in page load we are not getting dropdownlist value .  Is there any way to over come this issue .
  5. Bozhidar
    Admin
    Bozhidar avatar
    1102 posts

    Posted 22 Oct 2013 Link to this post

    Hi Santosh,

    In the Page_Load event you have to explicitly call DataBind() on the DropDownList before you can access the items.
     

    Regards,
    Bozhidar
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  6. Santosh
    Santosh avatar
    24 posts
    Member since:
    Sep 2013

    Posted 03 Nov 2013 Link to this post

    I use RadScheduler in my application...created resource collection and populated with some data.....but in the drop down by default the first list item is dispalyed as '-' which I dont want.I want default value irrespective of "-".

    just few mins back seen ur reply to this kind of issue
    This behavior is by design. If no resource of a specific type is associated with the appointment, the "-" option is selected for the dropdown list. (posted on dec 27 2007) ...... got any solution to this issue . 
  7. Bozhidar
    Admin
    Bozhidar avatar
    1102 posts

    Posted 04 Nov 2013 Link to this post

    Hi Santosh,

    You can use the OnFormCreated event to get a reference to the resource ComboBox and change it's selected index. The event is described in the following help article:
    http://www.telerik.com/help/aspnet-ajax/scheduler-formcreated.html

    For example to preselect the first Resource of ResourceType Room in the AdvancedInsert form, you would write the following:
    protected void scheduler_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
    {
        if (e.Container.Mode == SchedulerFormMode.AdvancedInsert)
        {
            RadComboBox combo = (RadComboBox)e.Container.FindControl("ResRoom");
            combo.Items[1].Selected = true;
        }
    }

     

    Regards,
    Bozhidar
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  8. Santosh
    Santosh avatar
    24 posts
    Member since:
    Sep 2013

    Posted 04 Nov 2013 Link to this post

    Thanks For the reply .... but we are using radresource(radresource types)  in radschedular.we want an default value instead of "-" and we don't want selected value to be placed instead of "-".For Detail we want "Active" text to be placed instead of "-" in Edit Appointment. Is their any way to solve this issue.
  9. Bozhidar
    Admin
    Bozhidar avatar
    1102 posts

    Posted 07 Nov 2013 Link to this post

    Hello Santosh,

    The ComboBox is pre-populated with all the available resources, and the "-" item is added to indicate that no resource is selected. If you want to add a default value, it has to be one from the items already in the combo, otherwise it's going to be an invalid resource. If you don't want the "-" item to be visible, you can just set it"s Visibility property to false. 

    If on the other hand you want to simply change it's text, so that you have a default item called "Active", which when selected specifies that the Appointment doesn't have any resources, you can again get a reference to this item and set its text.
     

    Regards,
    Bozhidar
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017