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

Mask column

Thread ID:





122089 Feb 16,2016 03:24 PM UTC Feb 19,2016 12:54 PM UTC ASP.NET Web Forms 3
Tags: Grid
Jorge Pampin
Asked On February 16, 2016 03:24 PM UTC


How to set this mask "#00° 00' 00'' / #000° 00' 00''" to a column? It's a mask to enter gps localization values.


Ajith R [Syncfusion]
Replied On February 17, 2016 12:31 PM UTC

Hi Jorge,

Thanks for using Syncfusion products.

Query 1: How to set this mask "#00° 00' 00'' / #000° 00' 00''" to a column?

We suggest you to use QueryCellInfo client side event and set the corresponding format using grid formatting method to achieve your requirement. Refer the below code snippet for further details.

<ej:Grid ID="Grid" runat="server" AllowPaging="true">

        <ClientSideEvents QueryCellInfo="cellInfo" />




<script type="text/javascript">

     function cellInfo(args) {           

            if (args.column.headerText == "GPS") {

                if (args.text.indexOf("°") == -1) {

                    var dms = getDMS(args.data.Location["Latitude"]); // Get DMS value from latitude

                    // Set DMS format using grid formatting method

                    var text = this.formatting("{0:D2}", dms.degree) + "°" + this.formatting("{0:D2}", dms.min) + "'" + this.formatting("{0:D2}", dms.sec) + "''";

                    $(args.cell).text(text); // Set formatted text to the cell




        function getDMS(val) {

            // convert decimal degree to DMS

            var dms = {};

            var degree = dms["degree"] = Math.floor(val);

            var min = dms["min"] = Math.floor((val - degree) * 60);

            dms["sec"] = Math.floor((val - degree - min / 60) * 3600);

            return dms;



Query 2: It's a mask to enter gps localization values.

We suggest you to use EditTemplate for the corresponding column to render Mask control while editing in the Grid. Please refer the below code snippet and UG Documentation for further details.

<ej:Grid ID="Grid" runat="server" AllowPaging="true">       




            <ej:Column Field="Location.Latitude" HeaderText="GPS" Width="100" Type="String">

                <EditTemplate Create="create" Read="read" Write="write" />



<script type="text/javascript">

        function create() {

            return $("<input>");


        function write(args) {

            args.element.ejMaskEdit({ width: "100%", maskFormat: "##° ##' ##''", value: args.rowdata.Location !== undefined ? getMaskValue(args.rowdata.Location["Latitude"]) : "" });


        function read(args) {

           return args.ejMaskEdit("get_UnstrippedValue");


UG Doc: http://help.syncfusion.com/aspnet/grid/editing?cs-save-lang=1&cs-lang=html#cell-edit-template

Online Demo: http://asp.syncfusion.com/demos/web/grid/edittemplate.aspx

For your convenience we have created a simple sample and the same can be downloaded from the below link.

Sample: http://www.syncfusion.com/downloads/support/forum/122089/ze/Sample-746212353

We have created the above sample with data structure of [{Location: {Latitude: 11.11, Longitude: 23.43}}]. Please get back to us If you need the solution for any other data structure and provide us more detailed information regarding your requirement, so that we can provide you the solution based on your requirement.

Please let us know if you have any further concerns.

Ajith R

Jorge Pampin
Replied On February 18, 2016 09:06 AM UTC

How to add the simbols '+' '-' to the mask? The latitude/longitude can be a positive or a negative value.


Gowthami V [Syncfusion]
Replied On February 19, 2016 12:54 PM UTC

Hi Jorge,

We have an issue "MaskFormat character # not allowed +/- symbol” and created a new support incident under your account. . Please log on to our support website to check for further updates.



Gowthami V.


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