Create GridView Columns at Runtime

2 posts, 1 answers
  1. Robert
    Robert  avatar
    68 posts
    Member since:
    Feb 2009

    Posted 14 Jan 2010 Link to this post

    I'm witing to learn if it is possible to hide empty data columns in a Telerik Silverlight GridView.

    I am working with a Silverlight-enabled WCF Service, and the SQL Select Statement is created at runtime, based on selected Check Box Felds on the Silverlight Client MainPage.xaml.

    For example, a column exists with 10 fields (Check Boxes), and 3 fields are chosen.  When the GridView is displayed  on the .xaml page, there is data in the 3 chosen columns.  However, the other 7 empty data columns are displayed as well, and I am hoping hide the empty columns.

    An alternative option is only send to the Silverlight client the data columns selected, rather than all 10 fields.  In this case, hiding empty columns columns would not be necessary.  However, so far I am unable to configure the List properly to accomplish this type of task.

    Thanks in advance for any insight! Rob

  2. Answer
    Milan avatar
    1989 posts

    Posted 18 Jan 2010 Link to this post

    Hello Robert ,

    The best approach for your case is to set MinWidth and Width to 0 (MinWidth should be set first) for all columns that should not be displayed.

    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.
Back to Top