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

Read only cells

Hello,

How to set read only some cells based on their data?

Thanks!

3 Replies

GV Gowthami V Syncfusion Team November 12, 2015 12:49 PM UTC

Hi Jorge,

Thanks for using Syncfusion products.

We can understand from your query that you are using “Batch” edit mode since you have mentioned like read only cells.

We can achieve your requirement using “CellEdit” event of the grid as follows,

<ej:Grid ID="OrdersGrid" runat="server" >
            <ClientSideEvents CellEdit="cellEdit"/>
. . . .
<EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True" EditMode="batch" ></EditSettings>
. . .  .
   </ej:Grid>

<script type="text/javascript">

        function cellEdit(args)

        {

//We have prevent editing for the cell which contains LastName as “Beckett”

            if (args.columnName == "LastName" && args.value == "Beckett")

                args.cancel = true;

        }
        </script>


If we misunderstood your requirement please provide more details about your requirement like in which editing mode you want to change the cells as read only and the provided information will help to analyze the requirement and provide you the response as early as possible.

Regards,
Gowthami V.


JP Jorge Pampin November 12, 2015 12:59 PM UTC

Hello,

This is perfect! Thank you!


GV Gowthami V Syncfusion Team November 13, 2015 04:36 AM UTC

Hi Jorge,
 
We are happy to hear that your requirement has been achieved.
 
Get back to us if you need further assistance.
 
Thanks & Regards,
 
Gowthami V.

Loader.
Up arrow icon