How to set Maximum Value Slider Dynamically?

4 posts, 1 answers
  1. omer
    omer avatar
    65 posts
    Member since:
    Nov 2010

    Posted 27 May 2012 Link to this post

    Hello 

    Is it possible to set sliders maximum value dynamically?
    i mean something like this
    maximumvalue=<% bind.pricemaximum %>

    Thanks in advance
  2. Niko
    Admin
    Niko avatar
    387 posts

    Posted 29 May 2012 Link to this post

    Hi Omer,

     If you have the slider in a data-bound control's ItemTemplate, you can use the standard approach of data-binding for setting the Slider MaximumValue: 
    <asp:Repeater ID="theRepeater" runat="server">
        <ItemTemplate>
            <telerik:RadSlider ID="repeaterSlider" runat="server" Width="300px" MaximumValue="<%# Convert.ToDecimal(Container.DataItem) %>" ItemType="Tick" />
        </ItemTemplate>
    </asp:Repeater>
    theRepeater.DataSource = new[] { 10, 20, 30 };
    theRepeater.DataBind();

    At the same time you can use the client-side API method set_maximumValue to set the value as well.

    Hope this helps.

    Greetings,
    Niko
    the Telerik team
    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 their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. omer
    omer avatar
    65 posts
    Member since:
    Nov 2010

    Posted 29 May 2012 Link to this post

    Thank you for reply Niko,

    Actually i need set maximum value dynamically from my database. and my slider is not in itemtemplate.
    I need sync RadSliders Maximum Values property with My Databases Columns Maximum Values. 
    is there any way to do it?
    in database is maximum value is 15056 and dynamically in sliders maximum value too. 

    Kindly Regards

    Ömer

  5. Answer
    Niko
    Admin
    Niko avatar
    387 posts

    Posted 30 May 2012 Link to this post

    Hello Omer,

    You can always use the server-side API and once you have queried for the DB data you can use it to set the MaximumValue property of the RadSlider.
    var maxValueFromDB = GetMaxValueFromDB();
    theSlider.MaximumValue = maxValueFromDB;

    Hope this helps.

    Regards,
    Niko
    the Telerik team
    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 their blog feed now.
Back to Top