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.

Protect Cell(s) from Server Side Code?

Thread ID:

Created:

Updated:

Platform:

Replies:

126201 Sep 29,2016 08:47 PM Oct 13,2016 03:22 AM ASP.NET MVC 7
loading
Tags: Spreadsheet
shawn walsh
Asked On September 29, 2016 08:47 PM

Hi, is there a way to set the protection of a cell from the server side code?  I see in the client code you can do .lockCell, however I need to protect cells from the server.  I have a routine that reads all the properties of a cell from a sql table to a model in the view and would like to protect the cell if required in the server code as I am adding the cells dynamically in the view

Thank you for any help

Regards,
Shawn

Silambarasan I [Syncfusion]
Replied On September 30, 2016 09:02 AM

Hi Shawn, 
 
Thank you for using Syncfusion products. 
 
Your requirement “To set the protection of a cell from server side code” can be achieved by using “IsLocked” property in Spreadsheet.  Please refer the following code example. 
 
CONTROLLER 
 
public ActionResult SpreadsheetFeatures() 
{ 
    List<Sheet> sheets = new List<Sheet>(); 
    WorkbookProperties workbook = new WorkbookProperties() 
    { 
        //... 
        Sheets = sheets 
    }; 
 
    sheets.Add(new Sheet() 
    { 
        Rows = new List<Row>() 
        { 
            new Row()  
            { 
                Index = 0, //Row index 
                Cells = new List<Cell>() 
                {  
                    new Cell() { Value = "Item Name", IsLocked =  true }, 
                    new Cell() { Value = "Quantity", IsLocked =  true }, 
                    //... 
                } 
            }, 
            //... 
        } 
    }); 
 
    ViewData["spreadsheetModel"] = workbook; 
    return View(); 
} 
 
 
VIEW 
 
<div class="control"> 
    @(Html.EJ().Spreadsheet<object>("FlatSpreadsheet", (WorkbookProperties)ViewData["spreadsheetModel"])) 
</div> 
 
 
 
For your convenience, we have prepared a sample to demonstrate this and the same can be downloaded from below link, 
 
Regards, 
Silambarasan I 


shawn walsh
Replied On September 30, 2016 09:50 AM

Perfect!!!!  This is exactly what I was hoping for!

Many, many thanks.   I am loving these components.

Best Regards,
Shawn

Silambarasan I [Syncfusion]
Replied On October 3, 2016 08:21 AM

Hi Shawn, 
 
Thanks for your update. 
 
We are happy to hear that your requirement has been achieved.  
Kindly get back to us if you need further assistance.  We will be happy to help you out. 
 
Regards,  
Silambarasan I 


shawn walsh
Replied On October 5, 2016 10:25 AM

Hi Silambarasan, I finally got around to downloading and trying out the sample on my dev machine.  I am getting the error 'Cell does not contain a definition for "IsLocked" in the controller.  This is occurring on both the sample you sent and my project.  Is this an issue with the Syncfusion nuget package versions, or my local installed Syncfusion components in the GAC? 

Any help is appreciated.

Regards,
Shawn

Silambarasan I [Syncfusion]
Replied On October 6, 2016 08:35 AM

Hi Shawn, 
 
Thanks for your update. 
 
We have checked the reported issue “Cell does not contain a definition for ‘IsLocked’ in controller” and we suspect that the cause of this issue is due to missing assembly references of required Essential Studio product version.  So, could you please ensure the following cases. 
 
1.  The referenced “Syncfusion” assemblies should be from “v14.2.0.28” or higher version [v14.3.0.49] since the ‘IsLocked’ property is available from Essential Studio 2016 Vol 2 SP1 v14.2.0.28 release onwards. 
 
2.  You should refer the same .NET Framework version for all our DLL references in your project. Example, if you refer the “Syncfusion.EJ.Export.dll” (v14.3400.0.49) in 4.0 .NET Framework its dependency “Syncfusion.EJ.dll” (v14.3400.0.49) should be referred with the same framework version. 
 
3.  You should refer the proper DLL’s version that targets the same .NET Framework version. Example, the “Syncfusion.EJ.dll” (v14.3400.0.49) reference should targets the .NET 4.0 Framework only.  
 
 
Could you please ensure the above cases and get back to us with more information such as current ES product version, installed Syncfusion NuGet package version if the issue still persists?  So, that we could able to sort out the cause of this issue and provide you a better solution quickly. The information provided would be great help for us to proceed further. 
 
 
Regards, 
Silambarasan I 


shawn walsh
Replied On October 12, 2016 07:00 AM

Hi Silambarasan ,

Thank you for the great detailed information.  I was able to get it working thanks to your example.  In my case it was still not working even though I had updated to 14.3.   Turned out I was missing some of the css and jquery files that were in your _Layout.cshtml file.  Going through them one by one got it to work.  Thanks for your outstanding assistance. 

Best Regards,
Shawn

Silambarasan I [Syncfusion]
Replied On October 13, 2016 03:22 AM

Hi Shawn, 
 
Thanks for your update.  We are happy to hear that your issue has been resolved. 
Kindly get back to us if you need any further assistance. 
 
Regards, 
Silambarasan I 


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.

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.

;