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

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

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

Ex.

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

Tks.

2 Replies

MA MaxLu 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.


GA Gobinath A Syncfusion Team 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.

 


Loader.
Live Chat Icon For mobile
Up arrow icon