Databinding silverlight gauge control in existing page

2 posts, 0 answers
  1. Scott
    Scott avatar
    6 posts
    Member since:
    Feb 2011

    Posted 02 Mar 2011 Link to this post


    I am new to silverlight....our requirements are for the fancy charts/gauges available in the silverlight rad controls product.  The problem is that we need to implement these silverlight charts/gages into an existing page.

    I have the gauge/chart showing in the aspx page but I am not sure what the best method is to bind data from a sql dataset/datatable to a chart and a gauge within an existing aspx page.

    Can someone provide some direction for me on how to achieve this requirement of databinding data from a sql dataset/datatable to a chart and a gauge control...( I assume the process will be almost identical for each)...

    Thanks in advance,
  2. Andrey
    Andrey avatar
    1681 posts

    Posted 04 Mar 2011 Link to this post

    Hi Scott,

    You can pass parameters to the Silverlight control using the user-defined initialization parameters for Silverlight Plug-in Object. The sample code below passes the gauge value to the Silverlight user control.
    Copy Code
    <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
      <param name="initparams" value="gaugeValue=25"/>
      <param name="source" value="ClientBin/RadControlsSilverlightApp1.xap"/>
      <param name="onError" value="onSilverlightError" />
      <param name="background" value="white" />
      <param name="minRuntimeVersion" value="4.0.50826.0" />
      <param name="autoUpgrade" value="true" />
      <param name="onload" value="pluginLoaded" />
      <a href="" style="text-decoration:none">
          <img src="" alt="Get Microsoft Silverlight" style="border-style:none"/>
    Copy Code
    <UserControl x:Class="RadControlsSilverlightApp1.MainPage"
        mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
        <Grid x:Name="LayoutRoot">
            <telerik:RadGauge Height="200" Width="200">
                            <telerik:Needle Name="Needle1" />
    Copy Code
    using System.Globalization;
    using System.Windows;
    using System.Windows.Controls;
    namespace RadControlsSilverlightApp1
        public partial class MainPage : UserControl
            public MainPage()
                string stringValue = Application.Current.Host.InitParams["gaugeValue"];
                double value = double.Parse(stringValue, CultureInfo.InvariantCulture);
                this.Needle1.Value = value;

    For more information please take a look to the following articles:

    Kind regards,
    Andrey Murzov
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top