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.
Syncfusion Feedback

How do I get the value of a column after select a line in GridDataControl

Thread ID:

Created:

Updated:

Platform:

Replies:

109666 Jun 26,2013 09:12 PM UTC Jul 25,2013 12:20 PM UTC WPF 2
loading
Tags: GridControl
Kennedy Silva
Asked On June 26, 2013 09:12 PM UTC

After selecting a line I need to get the text of a column

Ex.

text = mygrid.row(1).Collumn(4).ToString()

Tks.

MaxLu
Replied On July 5, 2013 04:43 PM UTC

I think you can bind the SelectedItem dependency property in the gridatacontrol. When you select the line, the datacontext of the line will be copied to the SelectedItem. Then you can do some thing on the datacontext.

Gobinath A [Syncfusion]
Replied On July 25, 2013 12:20 PM UTC

Hi Kennedy,

 

Sorry for the delay in getting back to you.

 

We have analyzed your query and you can get the Column name & Current Cell value by using below code snippet.

 

Code snippet[C#]:

 

this.syncgrid.ModelLoaded += new EventHandler(syncgrid_ModelLoaded);

 void syncgrid_ModelLoaded(object sender, EventArgs e)

  {

    this.syncgrid.SelectedItems.CollectionChanged += new

          System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedItems_CollectionChanged);

  }

 

  void SelectedItems_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)

    {

            var index = this.syncgrid.Model.CurrencyManager.CurrentCell.CellRowColumnIndex;

            var CellText = this.syncgrid.Model[index.RowIndex, index.ColumnIndex].CellValue;

            var ColumnName = this.syncgrid.VisibleColumns[index.ColumnIndex].HeaderText;

    }

 

 

Please let us know if you have any queries.

 

Regards,

Gobinath A.

 


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.

Warning Icon 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.Close Icon

;