Programatically Creating RadGridview and columns

4 posts, 0 answers
  1. Rana Pratap
    Rana Pratap avatar
    16 posts
    Member since:
    Sep 2009

    Posted 29 Oct 2009 Link to this post


    I am using Telerik silverlight controls  Q2 2009 , i have a requirement where i have to create grid view and columns dynamically in xaml.cs file, I also need to create dropdown and datepicker controls in edit mode through programatically. Please provide if any sample code avilable with similar kind of requirement.

    Thanks in advance

    Rana Pratap
  2. Vlad
    Vlad avatar
    11100 posts

    Posted 30 Oct 2009 Link to this post


    There is nothing special in RadGridView and/or columns programmatic creation - here is an example:

    var grid = new RadGridView();
    grid.Columns.Add(new GridViewDataColumn(){ Header = "ID", DataMemberBinding = new Binding("ID") });

    If you want to create however columns with custom CellTemplate and/or CellEditTemplate my suggestion is to inherit from GridViewDataColumn, override CreateCellElement and/or CreateCellEditElement and return your desired control.

    Best wishes,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. William
    William avatar
    37 posts
    Member since:
    Sep 2016

    Posted 07 Nov 2016 in reply to Vlad Link to this post

    This is not what various other posts have said - they all lead to "Changing the Grid Structure Dynamically on Postback" as the preferred way to change the structure. Which one is right? And is the documentation on this page only for "UI for Asp.Net" or does it also apply to "UI for WPF"?
  4. Stefan
    Stefan avatar
    774 posts

    Posted 09 Nov 2016 Link to this post

    Hi William,

    Actually, this forum section is for the UI for Silverlight suite. In order to keep the threads consistent, I would kindly ask you to post your question in the relevant section.

    Thanks in advance for your cooperation.

    Stefan X1
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top