We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Column selecting possible in GridDataControl?

Hi there,

I'm evaluating the Controls and have a question for the GridDataControl. Is it possible to select Columns (like in Excel)? In the GridControl I can do so, but there I can not set a DataSource. My data are coming from an ObservableCollection and I don't want to group or sort them.

Greetings
Andreas


5 Replies

RA Rajasekar Syncfusion Team February 3, 2011 02:01 PM UTC

Hi Andreas,

Thanks for choosing Syncfusion products.

Yes it is possible to select to columns in Grid Data Control by setting the property AllowSelection as Column and ListBoxSelectionMode as None.

You can prevent sorting and grouping by setting the property AllowGroup and AllowSort as false.

We have also prepared the sample for your reference, please find the sample in the following location,

Sample: < http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=ObservableCollection1472666354.zip >

Please let us know if you have any queries.

Thanks,
Rajasekar





AD Administrator Syncfusion Team February 7, 2011 01:04 PM UTC

Thank you Rajasekar,

it works so long I do not create Columns from CodeBehind. If I do so, I cannot select any Column.
This is my Grid:



And this is, how I create the columns:

private void AddDataColumn(string uniqueName, bool insert = false)
{
GridDataVisibleColumn column = new GridDataVisibleColumn();
if (uniqueName != " ")
{
column.MappingName = uniqueName;
}
else
{
column.MappingName = "col1";
column.IsReadOnly = true;
}
column.HeaderText = uniqueName;//p;
column.AllowSort = false;
column.AllowGroup = false;

if (insert)
{
int index = gdcEntscheidungstabelle.VisibleColumns.Count - 1;
this.gdcEntscheidungstabelle.VisibleColumns.Insert(index, column);
}
else
{
gdcEntscheidungstabelle.VisibleColumns.Add(column);
}
}

Any suggestions?




RA Rajasekar Syncfusion Team February 17, 2011 09:35 AM UTC

Hi Andreas,

Thanks for your update.

We have checked with your requirement and we have tested our sample by setting visible columns in code behind, but we are able to select the column in the grid. If you find any difficulties in the column selection, please revert us with modified sample and replication procedure.

Sample: < http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=DataContext-347944224.zip >

Please let us know if you have any queries.

Thanks,
Rajasekar





AD Administrator Syncfusion Team February 23, 2011 01:06 PM UTC

Hi Rajaseka,

you can use the code and the file I've posted in this thread (http://www.syncfusion.com/support/forums/grid-wpf/98363/Problem-with-GridDataControl-width). With this you have to able (so I think) to reproduce my problem.
At time I'm using the version 9.1, but with 8.4 it was the same problem.

Thanks,
Andreas



RA Rajasekar Syncfusion Team March 8, 2011 01:16 PM UTC

Hi Andreas,

Sorry for the Inconvenience caused.

We have analyzed the reported issue with our sample; we are not able to reproduce the issue. Can you please check with the sample in the following location? If possible can you share your full sample with us, which would be much appreciable?

Note: We have prepared the simple view model application in which visible columns are generated at code behind, here we can able to do column selection.

Sample : < http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=ColumnSelection1649028586.zip >

Please let us know if you have any queries.

Thanks,
Rajasekar



Loader.
Live Chat Icon For mobile
Up arrow icon