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

IGridColumnBuilder Format(string content) does not format string types

Thread ID:





109545 Jun 19,2013 09:42 AM UTC Jun 21,2013 12:16 PM UTC ASP.NET MVC (Classic) 1
Tags: Grid
Ronaldo Macapobre
Asked On June 19, 2013 09:42 AM UTC


I want to format (e.g. (123) 456-7890) the values in the Telephone field when displayed in the grid. Below is my code in cshtml. Note that Telephone has a "string" data type.

@{ Html.Syncfusion().Grid<AutoFormatting>("FormatGrid")





.Column( column =>


column.Add(c => c.Telephone)


                                   .Format("{0:(###) ###-####}");



Currently, formatting does not work for string types. Do you have any work around aside from creating another field with int or int64 type?


Abdul Matin M [Syncfusion]
Replied On June 21, 2013 12:16 PM UTC

Hi Ronaldo,


Thanks for using Syncfusion Products.


Your requirement to format string data type can be achieved using QueryCellInfo event. In QueryCellInfo event we have did formatting by converting the string to integer and again converted the result back to string and displayed the formatted string in the grid. Could you please refer the below code snippet.



public void QueryCellInfo(GridTableCell<AutoFormatting> cell)


            if (cell.TableCellType == GridTableCellType.RecordFieldCell || cell.TableCellType == GridTableCellType.AlternateRecordFieldCell)


                if (cell.Column.MappingName == "Telephone")


                    cell.Text = Convert.ToInt64(cell.Data.Telephone).ToString("(###) ###-####");





For your convenience we have attached a sample. Could you use that sample and get back to us if you have any queries.


Let us know if you have any other concerns.



Abdul Matin M.



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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