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.
Unfortunately, activation email could not send to your email. Please try again.

Manipulating the silverlight datagrid from code behind?

Thread ID:

Created:

Updated:

Platform:

Replies:

94249 Apr 30,2010 04:33 PM May 13,2010 06:54 AM Silverlight 3
loading
Tags: GridControl
Pankaj
Asked On April 30, 2010 04:33 PM

Hi
I am building a usercontrol which will contain Syncfusion silverlight datagrid. And I want to control visibility of columns from code behind. Are there any links to such samples?

In fact, I would like to know how to control other controls from code behind.

Thanks
AJ

Varun P [Syncfusion]
Replied On May 3, 2010 05:13 AM

Hi Pankaj,

Thanks for using Syncfusion products.

To control the VisibleColumns in code behind, set the AutoPopulateColumns="False" in the xaml.

In the code behind file use the following code to make the columns to be visible.

this.dataGrid.VisibleColumns.Add(new Syncfusion.Windows.Controls.Grid.GridDataVisibleColumn() { MappingName="OrderID",HeaderText="OrderID"});

I have attached a sample in the below location.

VisibleColumnSample-1669147914.zip

Please let me know if you have any queries.

Thanks,
Varun

Pankaj Mittal
Replied On May 7, 2010 11:34 AM

Thanks. but how to hide a column even though it is part of grid columns?

Also, how can we enable the click handler of a cell in grid?

Thanks

Varun P [Syncfusion]
Replied On May 13, 2010 06:54 AM

Hi Pankaj,

You can set the width of the column to 0 and it will not be shown in the grid. Please refer the below code snippet.







You can handle the cell click event. Please look into the below code snippet.

this.dataGrid.Model.Grid.CellClick += new GridCellClickEventHandler(Grid_CellClick);

Please let me know if you have any queries.

Thanks,
Varun

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;