Set GridViewDataColumn width to Auto

3 posts, 1 answers
  1. Nalini
    Nalini avatar
    9 posts
    Member since:
    Apr 2015

    Posted 27 May 2015 Link to this post

    Hello,

     

    Can someone tell how to set GridViewDataColumn width to Auto in C#. Below is the sample code.

    GridViewDataColumn firstName= new GridViewDataColumn();

    firstName.Header = "FirstName";

    firstName.Width=  Auto ?  //something like this?

     

     

    Thanks,

    Nalini

     

     

     

     

     

  2. Answer
    Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 28 May 2015 Link to this post

    Hello Nalini,

    You can set the Width like so:

    firstName.Width = new GridViewLength(0, GridViewLengthUnitType.Auto)


    Regards,
    Dimitrina
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Nalini
    Nalini avatar
    9 posts
    Member since:
    Apr 2015

    Posted 28 May 2015 in reply to Dimitrina Link to this post

    Thank You!

     

    Best Regards, 

    Nalini

Back to Top