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

Hide text boxes on inlineform add mode

Hi,

I'm working on a asp.net project using the syncfusion grid control. There are some columns in the grid (e.g. the primary key field) that I wish to display in the grid, but do not want the users to be able to Edit or type anything into when adding a new record. I am using inline form editing and have added AllowEditing="False" to the properties of the columns I wish to be read only. This works for the edit form, which has these text boxes greyed out, but when adding a new record the text boxes allow input. How can I either hide or lock these input boxes.

thanks

David

1 Reply

PK Prasanna Kumar Viswanathan Syncfusion Team July 16, 2015 12:10 PM UTC

Hi David,

Thanks for using Syncfusion products.

Your requirement has been achieved by using the property IsIdentity in columns of ejGrid.


Please refer the below UG documentation for more details regarding IsIdentity property,

Link : http://helpjs.syncfusion.com/js/api/ejgrid#members:columns-isidentity

Please refer the following code example :


<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">

        <ej:Grid ID="Grid" runat="server" AllowSorting="True" AllowPaging="True" AllowGrouping="true" AllowResizing="true"  AllowMultiSorting="true">

           <EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True" EditMode="InlineForm"></EditSettings>

           <ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings>

            <Columns>

                <ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="True" IsIdentity="true" TextAlign="Right" Width="100" />

                <ej:Column Field="CustomerID" HeaderText="Customer ID" Width="100" />

                <ej:Column Field="EmployeeID" HeaderText="Employee ID" TextAlign="Right" Width="100" />

                <ej:Column Field="Freight" HeaderText="Freight" TextAlign="Right" Width="100" Format="{0:C}" />

                <ej:Column Field="OrderDate" HeaderText="Order Date" TextAlign="Right" Width="100" Format="{0:MM/dd/yyyy}" />

                <ej:Column Field="ShipCity" HeaderText="Ship City" Width="100" />

            </Columns>

        </ej:Grid>
</asp:Content>


Please refer the below screenshot :



For your reference, we attached a sample in the following link

Sample Link : http://www.syncfusion.com/downloads/support/forum/119617/ze/Sample2129905322

Please let us know if you need any further assistance.

Regards,
Prasanna Kumar N.S.V

Loader.
Live Chat Icon For mobile
Up arrow icon