I have a simple grid that allows the user to add new contacts. Certain need to be pre-populated and set to read only so the user cannot change then.
I've tried using <telerik:GridBoundColumn DataField="STATUS" HeaderText="Status" ReadOnly="true"/> but this hides the column when you try to add a new contact. I've tried various different way to render the column as read only including using a prerender function and attempting to set the read only status using javascript but i'm struggling to find the correct syntax for it.
My full code:
<telerik:RadGrid RenderMode="Lightweight" runat="server" ID="RadGridContats" AutoGenerateColumns="false" AllowPaging="true"
OnNeedDataSource="RadGridContats_NeedDataSource" OnUpdateCommand="RadGridContats_UpdateCommand"
OnInsertCommand="RadGridContats_InsertCommand" >
<MasterTableView DataKeyNames="ContactID" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage">
<CommandItemSettings AddNewRecordText="Add Contact" />
<Columns>
<telerik:GridEditCommandColumn />
<telerik:GridBoundColumn DataField="ContactID" HeaderText="ID" ReadOnly="true" Visible="false"
ForceExtractValue="Always" ConvertEmptyStringToNull="true" />
<telerik:GridBoundColumn DataField="Firstname" HeaderText="First Name">
<ColumnValidationSettings EnableRequiredFieldValidation="true" >
<RequiredFieldValidator ForeColor="Red" ErrorMessage=" Please enter a first name"></RequiredFieldValidator>
</ColumnValidationSettings></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Lastname" HeaderText="Last Name">
<ColumnValidationSettings EnableRequiredFieldValidation="true" >
<RequiredFieldValidator ForeColor="Red" ErrorMessage=" Please enter a last name"></RequiredFieldValidator>
</ColumnValidationSettings></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Email" HeaderText="Email">
<ColumnValidationSettings EnableRequiredFieldValidation="true" >
<RequiredFieldValidator ForeColor="Red" ErrorMessage=" Enter a valid email address"></RequiredFieldValidator>
</ColumnValidationSettings></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Workphone" HeaderText="Phone" />
<telerik:GridBoundColumn DataField="Title" HeaderText="Title" />
<telerik:GridBoundColumn DataField="Status" HeaderText="Status" ReadOnly="true"/>
<%--<telerik:GridButtonColumn HeaderStyle-Width="20px" Text="<img src=/_layouts/15/Styles/LeadGen/images/deactivate4.png border=0 align=absmiddle alt='Select this Item'>" CommandName="Select"></telerik:GridButtonColumn>--%>
</Columns>
</MasterTableView>
<PagerStyle Mode="NextPrevAndNumeric" />
</telerik:RadGrid>
Any help is greatly appreciated.