This is a migrated thread and some comments may be shown as answers.

Access display values go through specify row and column

3 Answers 57 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Wanlop
Top achievements
Rank 1
Wanlop asked on 07 Apr 2017, 03:51 AM

 

Hi Telerik Team,

 

I would like to access grid data which I prefer the converted data.
But while I try to access through the properties "items" or "itemsource" - we got the raw data which it still not be converted.

At the same time the data that I need is all data on view area and out of view area.

 

Could you please give me an example or advice ?

 

Best Regards,

Wanlop Niwatsreesupun

3 Answers, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 11 Apr 2017, 01:48 PM
Hello Wanlop,

If you're using a converter for your bindings, you can get ahold of that and use the converted values:

var column = this.clubsGrid.Columns["Name"] as GridViewDataColumn;
var converter = column.DataMemberBinding.Converter;
if (converter != null)
{
    var formattedValue = converter.Convert((this.clubsGrid.SelectedItem as Club).Name, typeof(string), null, CultureInfo.CurrentCulture);
    MessageBox.Show(formattedValue.ToString());
}

On the other hand, if you're formatting the cell values by using the DataFormatString property, you can also use that when accessing the values like so:

var column = this.clubsGrid.Columns["Established"] as GridViewDataColumn;
if (!string.IsNullOrWhiteSpace(column.DataFormatString))
{
    var formattedValue = string.Format(column.DataFormatString, (this.clubsGrid.SelectedItem as Club).Established);
    MessageBox.Show(formattedValue);
}

Please let me know if you find these suggestions helpful.

Regards,
Dilyan Traykov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Wanlop
Top achievements
Rank 1
answered on 12 Apr 2017, 02:53 AM

Hi Dilyan,

Thanks for your suggestion but I have tested but It not good performance.

It still bad performance because we need to loop for all rows and columns to convert these values.

Do you have the other suggestion to export all formatted data with highest performance ?

 

Best Regards,

Wanlop Niwatsreesuphun

0
Dilyan Traykov
Telerik team
answered on 12 Apr 2017, 12:46 PM
Hello Wanlop,

Unfortunately, I cannot offer any other suggestions based on your requirements.

Regards,
Dilyan Traykov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
Wanlop
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Wanlop
Top achievements
Rank 1
Share this question
or