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.

Setting selected node

Thread ID:

Created:

Updated:

Platform:

Replies:

121500 Dec 21,2015 12:05 PM Dec 22,2015 11:44 PM WPF 3
loading
Tags: GridTreeControl
Volkan Paksoy
Asked On December 21, 2015 12:05 PM

Hello,

In my application I have 2 GridTree controls. When the application launches it reads some data and depending on that populates the first grid and based on the selected value the second one's contents are loaded. 

Is it possible to set the selected row of a grid programmatically on start? I set SelectedNode value but the row doesn't appear to be selected.

Thanks.

Sowndaiyan Paulpandi [Syncfusion]
Replied On December 22, 2015 05:54 AM

Hi Volkan,


Thank you for contacting Syncfusion Support.


We have analyzed your query. You can achieve your requirement “set the selected row of a grid programmatically on initially” like the below code example. In this code example, we have added the corresponding node to TreeGrid.InternalGrid.SelectedNodes and the IsSelected property of the particular node is set to true.


Code Example [C#]:



public
MainWindow()

        {

            InitializeComponent();

            this.treeGrid.Loaded += treeGrid_Loaded;

        }


void treeGrid_Loaded(object sender, RoutedEventArgs e)

        {

            var Node = treeGrid.InternalGrid.Nodes.FirstOrDefault(node => (node.Item as EmployeeInfo).EmpID == 1005);

            if (Node == null)

                return;

            Node.IsSelected = true;

            treeGrid.InternalGrid.SelectedNodes.Add(Node);

        }


We have prepared a sample as per your requirement and you can download sample from the below location,

Sample : http://www.syncfusion.com/downloads/support/forum/121500/ze/Tree_node_selection_with_specific_row831819400



Regards,

Sowndaiyan




Volkan Paksoy
Replied On December 22, 2015 06:03 AM

Worked beautifully! Thank you very much for the help.

Sowndaiyan Paulpandi [Syncfusion]
Replied On December 22, 2015 11:44 PM

Hi Volkan,


Thanks for the update.


Please let us know if you need further assistance.


Regards,

Sowndaiyan

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.

;