Binding Data Index to Row Index

3 posts, 0 answers
  1. Kim
    Kim avatar
    2 posts
    Member since:
    Nov 2015

    Posted 27 Dec 2015 Link to this post

     

    hello.

    Please teach me the way.

     

    GridView SourceData : Binding : List, DataTable...

     1. Binding Data  Index => GridView Row Index

    2. GridView Row Index => Binding Data Index

     

     

  2. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    710 posts

    Posted 28 Dec 2015 Link to this post

    Hello Kim,

    Thank you for writing.

    RadGridView maps its rows to the data source object. At any time you can get a reference for the data bound object  of a row by accessing its DataBoundItem property: 
    object data = this.radGridView1.CurrentRow.DataBoundItem;
    The indices of the rows in the grid correspond to the indices of the data bound objects.

    If you will be working with a DataTable the data bound item would be a DataRowView and if you have a collection of a custom object its type would be the type of your object. Detailed information about the different options to bind RadGridView are discussed in the following section of our documentation: Populating with Data.  Please note that in order to reflect custom changes in your model object class it would need to implement the INotifyPropertyChanged interface. An example is available here: Reflecting Custom Object Changes in RGV.

    I am sending you attached a project containing examples for binding to a DataTable and a collection of data objects. Besides the project, I am also sending you a short animation showing the result on my end.

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Kim
    Kim avatar
    2 posts
    Member since:
    Nov 2015

    Posted 28 Dec 2015 in reply to Hristo Merdjanov Link to this post

    Thank you for your prompt reply. Express deep gratitude.

     

Back to Top