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. Image for the cookie policy date
close icon

Is there a way to decrypt and bind the datasource to EJ grid?

Hi,

Is there a way to decrypt and bind the datasource to EJ grid, some of my database columns like dob are encrypted with MACTripleDES, how do we decrypt and bind that to ej grid?

{
...
....
var datasource;
....
....
ViewBag.datasource = DataSource.ToList();
return View();
}

1 Reply

BM Balaji Marimuthu Syncfusion Team January 8, 2016 11:38 AM UTC

Hi Ashok,

Thanks for contacting Syncfusion support.

To bind the decrypted dataSource in Grid, you need to decrypt it and bind the list of dataSource to the Grid. Please refer to the online link for encrypt & decrypt the data.

http://www.codeproject.com/Articles/14151/Encrypt-and-Decrypt-Data-with-Csharp

Refer to the code example as below.


[Controller]

  var encrypteddata = new NorthwindDataContext().Orders.Take(10).ToList();

          

            List<Order> decryptordertable = new List<Order>();

            foreach (var id in encrypteddata)

            {

                dynamic obj = id;


                decryptordertable.Add(new Order()

                {

                    OrderID = obj.OrderID,

                    EmployeeID = obj.EmployeeID,

                   CustomerID = Decrypt(obj.CustomerID, true),

                    Freight = obj.Freight,

                    ShipCity = obj.ShipCity

                });


            }
   ViewBag.datasource = decryptordertable;

[View]

@(Html.EJ().Grid<object>("Grid")

        .Datasource((IEnumerable<object>)ViewBag.datasource)

)


If we misunderstood your requirement, please share more information that will be helpful to provide a better solution at the earliest.

Regards,
Balaji Marimuthu

Loader.
Live Chat Icon For mobile
Up arrow icon