Telerik blogs

Latest

  • Web ASP.NET MVC

    Resolving circular references when binding the MVC Grid

    Sometimes when performing ajax databinding with the MVC grid you may end up with unexpected result: server error 500. What is even stranger is that server-side binding works as expected with the same data binding code. Let’s demystify this problem: The problem You will see the following  if you use FireBug or Fiddler to inspect the response: The error message is “A circular reference was detected while serializing an object of type” followed by some type. If you google this up you will find out that this exception is thrown by the JavaScriptSerializer class because of circular references detected. “What the heck is a...
    January 25, 2010
  • Web

    Math toolbar for column headers in RadGridView for Silverlight

      A client has recently asked for these little fancy math toolbars in the column header. I found it a great idea and thought it might be useful to share the way of implementing this with RadGridView for Silverlight.   *Since RadGridView for WPF shares the same code base  the approach bellow may be used for both platforms ( Silverlight and WPF ) .   Things are easy with RadGridView !   To have this in your project follow these three easy steps :   1. Copy the MathToolBar user control from the attached sample project (MathToolBar.xaml, MathToolBar.cs). MathToolbarDemo.zip 2. Replace the default header in the column with the user control. <telerik:GridViewDataColumn ... <telerik:GridViewDataColumn.Header> <local:MathToolBar HeaderText="Value1"/> </telerik:GridViewDataColumn.Header> </telerik:GridViewDataColumn>   3. Adjust...
    January 22, 2010
  • Web

    How To: Customize RadGridView's Default Filtering Control with Attached Behaviors (Silverlight &amp; WPF)

    If you are familiar with the RadGridView‘s Custom Filtering Functionality you probably know that you can create any kind of user control to replace the default one which looks like this: Very often, however, you may be perfectly happy with the stock filtering control, but you wish you could modify and adapt it just a little bit to match your particular requirements. What should you do then? Maybe build an entirely new filtering control from scratch that looks just like RadGridView’s default one and adds this tiny bit of functionality? No, that would be insane. There is an easier way to do this....
    January 22, 2010
  • Web

    How To: Serialize your DataTable to Silverlight using WCF service

    Did you know that you can serialize any DataTable to Silverlight easily from your custom WCF service in very few lines of code? [OperationContract] public IEnumerable<Dictionary<string, object>> GetData() { var table = YourDataTable; var columns = table.Columns.Cast<DataColumn>(); return table.AsEnumerable().Select(r => columns.Select(c => new { Column = c.ColumnName, Value = r[c] }) ...
    January 22, 2010
  • Web

    MicroModels for Silverlight

    Last week I was impressed by Paul Stovell’s marvelous project – MicroModels. In a nutshell a micro model is a view model over your objects, which allow you to define dynamic properties, collection and commands. You can read more about it in Paul’s introductory blog post here. Despite its great features, “MicroModels” has one big limitation - it does not run in Silverlight. And this is where my journey began. My mission was to port the code to Silverlight with little to no modifications. Porting the code to Silverlight The task was not an easy one, but after a lot of head scratching...
    January 21, 2010