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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Different currency symbol per row

Thread ID:

Created:

Updated:

Platform:

Replies:

78259 Dec 5,2008 01:50 PM UTC Jan 12,2009 07:18 AM UTC WinForms 6
loading
Tags: Grouping
Kenleith Primaylon
Asked On December 5, 2008 01:50 PM UTC

I was able to show the currency symbol by setting the CurrencyEdit. My problem is how to show a different currency per row. You see I have this datatable that holds the symbol base on column name and primary key of the row. I tried using the QueryCellStyleInfo event, I use e.TableCellIdentity.Column.Name to identify the column which is ok. Problem is the row, I cannot get the correct row index that match on what is in the datatable. I used e.TableCellIdentity.RowIndex, not correct. Another solution (codes below)...it's quite slow and it only works on 1 level tale, it doesn't work on nested table...

Table table = q_dgsView.TableControl.Table;
Element el = table.DisplayElements
[e.TableCellIdentity.RowIndex];
int dataRowPos = 0;

if (el != null)
{
Record rIndex = el.ParentRecord;
dataRowPos = table.UnsortedRecords.IndexOf (rIndex);
}

hope someone can help me...thanks in advance


Nisha Arockiya A [Syncfusion]
Replied On December 8, 2008 07:37 AM UTC

Hi KenP,

Thanks for your interest in syncfusion Products.

To set the individual cell style properties, you need to handle either the QueryCellStyleInfo or the TableControl's PrepareViewStyleInfo.


private void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if(e.TableCellIdentity.RowIndex > 0 && e.TableCellIdentity.ColIndex > 0)
{
if(flag)
{
Table table = this.gridGroupingControl1.Table;
Element el = table.DisplayElements[e.TableCellIdentity.RowIndex];
Record r = el.ParentRecord;
int dataRowPos = table.UnsortedRecords.IndexOf(r);

if(dataRowPos == 5)
{
if(e.TableCellIdentity.ColIndex == 4)
{
e.Style.CurrencyEdit.CurrencySymbol = "CHF ";
e.Handled = true;
}
}
}
}
}


Sample:
Here is the sample.

Let us know if this helps.
Regards,
Nisha


Kenleith Primaylon
Replied On December 8, 2008 09:32 AM UTC

hi. thank you for helping. Yes I use QueryCellStyleInfo. But my problem is what row indexer to use in accessing datatable

DataRow dr = DataTable.Rows[e.TableCellIdentity.RowIndex - 1]

this doesn't give the correct row position...

>Hi KenP,

Thanks for your interest in syncfusion Products.

To set the individual cell style properties, you need to handle either the QueryCellStyleInfo or the TableControl's PrepareViewStyleInfo.


private void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if(e.TableCellIdentity.RowIndex > 0 && e.TableCellIdentity.ColIndex > 0)
{
if(flag)
{
Table table = this.gridGroupingControl1.Table;
Element el = table.DisplayElements[e.TableCellIdentity.RowIndex];
Record r = el.ParentRecord;
int dataRowPos = table.UnsortedRecords.IndexOf(r);

if(dataRowPos == 5)
{
if(e.TableCellIdentity.ColIndex == 4)
{
e.Style.CurrencyEdit.CurrencySymbol = "CHF ";
e.Handled = true;
}
}
}
}
}


Sample:
Here is the sample.

Let us know if this helps.
Regards,
Nisha




Nisha Arockiya A [Syncfusion]
Replied On December 9, 2008 12:09 PM UTC

Hi KenP,

Thanks for your Updates.

Try working directly with the row instead of its parent.


if(e.TableCellIdentity.ColIndex > 0 && e.TableCellIdentity.RowIndex > 0 &&
e.TableCellIdentity.DisplayElement is GridRecordRow
&& e.TableCellIdentity.Column != null) //make sure a column is being requested
{
GridRecordRow row = e.TableCellIdentity.DisplayElement as GridRecordRow;
if(row != null)
{
DataRowView drv = row.GetData() as DataRowView;
if(drv != null)
{
string name = e.TableCellIdentity.Column.Name;
Console.WriteLine(e.Style.Text + " " + drv[name].ToString());
}
}
}


Please let me know if this helps.

Regards,
Nisha


Kenleith Primaylon
Replied On January 11, 2009 12:23 PM UTC

it worked! thank you so much!


Kenleith Primaylon
Replied On January 11, 2009 01:09 PM UTC

it worked! thank you so much!


Nisha Arockiya A [Syncfusion]
Replied On January 12, 2009 07:18 AM UTC


Hi KenP,

Thanks for the updates.

Please let us know any other concerns.

Regards,
Nisha.


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

;