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

Keeping the .AllowEditing(false) different for the Add form and Edit form

Thread ID:

Created:

Updated:

Platform:

Replies:

140964 Nov 15,2018 10:54 PM UTC Nov 19,2018 08:25 AM UTC ASP.NET MVC 3
loading
Tags: Grid
Sandip
Asked On November 15, 2018 10:54 PM UTC

Hello,
I am using the ASP.net MVC grid.
I am using InlineForm to modify the data. I don't want certain fields to be editable so in a column, i have set AllowEditing(False) as shown below. however i do this Fields to be editable in the Add form but its disabled.  does anyone knows how to achieve this?

   col.Field(x => x.Handing)
                                              .HeaderText("Handing")
                                              .TextAlign(TextAlign.Left).AllowEditing(false)
                                              .Width(45)
                                              .Add();

Vignesh Natarajan [Syncfusion]
Replied On November 16, 2018 10:41 AM UTC

Hi Sandip, 
 
Thanks for contacting Syncfusion support.  
 
From your query, we understand that you need prevent the column from being edited and at same time you need to add values to that column while adding. We have achieved your requirement using ActionComplete event of ejGrid.  
 
Refer the below code example 
 
(Html.EJ().Grid<object>("Grid") 
                    .Datasource(ds => ds.URL("UrlDataSource").UpdateURL("UrlUpdate").InsertURL("UrlInsert").RemoveURL("UrlDelete") 
                    .Adaptor(AdaptorType.UrlAdaptor)) 
                    .AllowPaging() 
                    .AllowFiltering() 
                    .AllowGrouping() 
                    .AllowSorting() 
                    .AllowSearching() 
                    .ClientSideEvents(e=>e.ActionComplete("Complete")) 
                    .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); }) 
                    .                    .                 .                .                  .              .          .  
) 
<script type="text/javascript"> 
     
    function Complete(args) {   
        if (args.requestType == "beginedit") {  // disable when request type is beginedit  
            //Grid ID + ColumnName 
            $("#GridCustomerID").addClass("e-disable");    
            $("#GridCustomerID").attr("disabled",true);  // disable the element from editing 
        } 
    } 
    </script> 
 
For your convenience we have prepared a sample which can be downloaded from below link 
 
 
Refer the below Knowledge base document to disable the dropdownlist while editing and enable it while adding  
 
 
Refer our help documentation for your reference 
 
 
 
Please get back t us if you have further queries. 
 
 
Regards 
Vignesh Natarajan  


Sandip
Replied On November 19, 2018 12:21 AM UTC

Thanks. This solution works for me.

Vignesh Natarajan [Syncfusion]
Replied On November 19, 2018 08:25 AM UTC

Hi Sandip, 


Thanks for the update. 


We are glad to hear that your query has been resolved by your solution. 


Please get back to us if you have further queries. 


Regards, 
Vignesh Natarajan  


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.

Please sign in to access our forum

or the page will be automatically redirected to 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

;