You must Sign In to post a response.
  • Category: .NET

    Hiding a column of devexpress GridControl

    Hi,
    I am new to the devexpress controls.
    I am able to bind devexpress gridcontro, with the dataset.
    Now I want to hide a particular column hide based on condition. and it will be done through code.
    Kindly help with this.
    It was very easy with windows control.


    with regards,
    Binay Kumar Prasad.
  • #768630
    Hi,

    Have you tried the properties values.
    Please use the GridColumn.Visible Property rather than Visibility property. Set this property to False. This should fix the issue.



    private void GetCompleted(object sender, EntityService.GetEntitiesCompletedEventArgs e)
    {

    this.DataContext = e.Result;

    gridControl1.DataSource = e.Result;

    View.Grid.Columns[2].Visibility = Visibility.Collapsed;

    gridControl1.Columns["LastName"].Visibility = Visibility.Collapsed; // This will not hide

    }


    Thanks,
    Mani

  • #768665
    You can hide a column by setting the GridColumn.Visible property to false or by setting the GridColumn.VisibleIndex property
     GridView1.Columns(0).Visible = False
    ' OR
    GridView1.Columns(0).VisibleIndex = -1

    Useful reference:
    https://www.devexpress.com/Support/Center/Question/Details/Q236750
    https://www.devexpress.com/Support/Center/Question/Details/Q322914


Sign In to post your comments