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

Retrieving data from data grid

Thread ID:

Created:

Updated:

Platform:

Replies:

118355 Mar 2,2015 06:27 AM UTC Mar 9,2015 08:48 PM UTC WinRT 6
loading
Tags: SfDataGrid
manik narang
Asked On March 2, 2015 06:27 AM UTC

I have a datagrid and i want to get the data from the datagrid so that i can pass it to next page , Datagrid's Item source is binded to a viewmodel property that returns Observablecollection<model>
so basically in code behind i want to get the data of each row from data grid in any form be it string list or some list

Ashok N [Syncfusion]
Replied On March 3, 2015 04:30 PM UTC

Hi Manik,

Thank you for contacting Syncfusion support,


We have analyzed your query and please refer the following code snippet to retrieve the records from SfDataGrid.

var Record = this.sfdatagrid.View.Records;

foreach (var record in Record)

{

    var data = record.Data;

}

Please let us know if you require further assistance

Thanks,

Ashok

manik narang
Replied On March 3, 2015 05:25 PM UTC

Thank you so much, i will try it out and let you know if i am successful by the provided code

manik narang
Replied On March 4, 2015 03:46 AM UTC

Ashok,I have another Problem As i have Dynamic Columns to Enter My model looks like this->
class MapNetworkModel: BindableBase
        {
          
        
        private dynamic column1;
        public dynamic  Column1
        {
            get
            {
                return column1;
            }
            set
            {
                SetProperty(ref column1, value);
            }
        }
        private string _controllers;
        public string Controllers
        {
            get
            {
                return _controllers;
            }
            set
            {
                SetProperty(ref _controllers, value);
            }
        }

Consequently My Viewmodel Attached as DATACONTEXT looks like->

 class MapNetworkViewModel:BindableBase
    {

        public MapNetworkViewModel()
        {
            Device = new ObservableCollection<MapNetworkModel>();
        }
       
        public ObservableCollection<MapNetworkModel> Device { get; set;}

    }

The 'Device' is binded as an item source of SFDAtagrid and i am adding columns in code behind like this-> 

   datagrid.Columns.Add(new GridCheckBoxColumn { HeaderStyle = this.Resources["headerstyle"] as Style, HeaderText = s.NetworkType + "-" + count, MappingName="Column1" });

but i have a list of boolean data at each record
Column1 is always showing null in "var data" but i want boolean values
       

Attachment: New_Bitmap_Image_(2)_e8bf723b.zip

Ashok N [Syncfusion]
Replied On March 5, 2015 03:08 PM UTC

Hi Manik,

We have analyzed your query, but we are unable to replicate the issue. We can able to get the Column1 value using our previous updated code example and we have prepared a sample using your code snippet and attached in the below link. Can you please revert the sample by modifying it to reproduce the issue? So, it would be helpful for us to proceed further​ and resolve the issue. You can find the sample from the following location: http://www.syncfusion.com/downloads/support/directtrac/118355/RetrieveData-1584485054.zip

Please let us know if you require further assistance

Thanks,

Ashok



manik narang
Replied On March 5, 2015 05:09 PM UTC

I have modified the Project so that you could understand the problem,Please help me in extracting data out of these checkbox columns are made at runtime as they are not binded to data source 

Attachment: RetrieveDataReconfigured_first_page_to_Blankpage1_xaml_f23780d5.zip

Ashok N [Syncfusion]
Replied On March 9, 2015 08:48 PM UTC

Hi Manik,

We are sorry about the inconvenience caused.

We have analyzed your query and we have prepared a sample based on your requirement and attached in the below sample link, please refer it.

Sample link: http://www.syncfusion.com/downloads/support/directtrac/118355/NewDataRetrieve-108649410.zip

Please let us know if you require further assistance,

Thanks,

Ashok



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

;