How to Set Read-Only Fields on Custom Grid using Super Grid?

Custom grid using Super Grid allows you to change values on a view inline without getting into the form. In some business scenarios, you would want to edit only a few column fields while making the rest of the fields as read-only. To enable this functionality, you are required to create a web resource on the custom grid you create following the below steps. For instance, let’s consider Account entity on which the custom grid is created.

Step 1:

In the custom gird that you created, click the Settings Icon.  Form Settings window opens up.


Step 2:

Select the Events tab on Form settings as highlighted in the below image. Events window opens up.

Step 3:

Click on Add Web Resource as shown below.                           

Step 4:

From the Look up record, create a new Web Resource by clicking New button.

Create web resource using the below code.

function onloadfn1() {

var customgrid = Xrm.Page.getCustomGrid("Igrid");

var statecode = parent.parent.Xrm.Page.getAttribute("statecode").getValue();

if (statecode != null && statecode != undefined) {

if (statecode != 0)


for (var col = 0; col < customgrid.grid.Columns.length; col++)







Step 5:

In the Function Name field, enter the same function name that you have used in the code (i.e., onloadfn1).

Step 6:

Save & Close the settings.

You can notice that the first column is now read only after adding the web resource.

Get your team together working more productively using MTC’s Super Grid. Click here to download.