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

GetFormattedText in GridTextBoxCellModel

Thread ID:

Created:

Updated:

Platform:

Replies:

55881 Feb 6,2007 03:50 PM UTC Feb 14,2007 11:49 PM UTC Windows Forms 5
loading
Tags: GridControl
Nevin
Asked On February 6, 2007 03:50 PM UTC

Hello there,

We have inherited the GridTextBoxCellModel class to expand our formula cell capabilities. We have overriden
GetFormattedText(GridStyleInfo style, object, int)

In this overriden method we are trying to get the

style.FormattedText or style.FormatPreview which has got our main value (6) and not the formula (2*3). This in turn triggers some events in the syncfusion code and GetFormattedText is again called recursively which ends up in StackOverFlow.
We also tried style.GetOffLineCopy() to get the value which didn't help us.
We also tried using the custom FormulaTag, but FormulaTag.Text is not at all refreshed during execution, if we put a break point it gets refreshed or what we have to do is hit the formula engine to get the value which does not suite our requirement.

Can you please let us know how to get the value from this property (sytle.FormattedText) without hitting the same overriden method again (StackOverFlow exception).

This is a major issue for us, kindly do the needful.

Thanks and Regards,
Nevin

Nevin
Replied On February 6, 2007 03:53 PM UTC

Just for your information we are using 4.3 version of Syncfusion.

Regards,
Nevin

Administrator [Syncfusion]
Replied On February 6, 2007 07:12 PM UTC

Hi Nevin,

You can use the base.GetFormattedText() method to get the formatted text in a GetFormattedText override method of the derived GridTextBoxCellModel class. Here is a code snippet.

public class MyTextBoxCellModel : GridTextBoxCellModel
{
public MyTextBoxCellModel(GridModel grid): base(grid){}
public override GridCellRendererBase CreateRenderer(GridControlBase control)
{ return new MyTextBoxCellRenderer(control, this);}
public override string GetFormattedText(GridStyleInfo style, object value, int textInfo)
{
string FormattedText = base.GetFormattedText (style, value, textInfo);
Console.WriteLine(FormattedText);
return FormattedText;
}
}
public class MyTextBoxCellRenderer : GridTextBoxCellRenderer
{
public MyTextBoxCellRenderer(GridControlBase grid, GridCellModelBase cellModel) : base(grid, cellModel)
{
this.SupportsFocusControl = true;
this.SupportsEditing = true;
}
}

Best Regards,
Haneef

Nevin
Replied On February 7, 2007 09:01 AM UTC

Hi Haneef,
Thank you for the quick response.
We had tried this option earlier base.GetFormattedText() but this will return the same text as style.Text. In our case it returns the Formula (2*3) and not the value (6).

We had a look into the base class where we found that it is raising
Grid.RaiseQueryCellFormattedText(ea);
if (ea.Handled)
return ea.Text;
and returning the Text rather than FormatValue which is the last line of the GridTextBoxCellModel :: GetFormattedText(..)

Is there any other work around to get the value which is present in style.FormattedText or style.FormatPreview.

Regards,
Nevin

Nevin
Replied On February 14, 2007 06:42 AM UTC

Hello Haneef,

The problem mentioned above is quite critical to our project and needs to be resolved ASAP. Can you kindly let us know the status. Kindly advice in case we need to submit this issue in direct-trac.

Looking forward to your reply.

Regards,
Nevin

Administrator [Syncfusion]
Replied On February 14, 2007 11:49 PM UTC

Hi Nevin,

My apologizes for the delay caused on this issue.

Please try the attached sample and let me know if this helps.
FormulaCellModel.zip

Best regards,
Haneef

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

;