I can't make it read only because when the field is gone(read-only) it passes "null" on my SQL Proc
Kindly please help on how to achieve this ?
8 Answers, 1 is accepted

How are you connecting to your data? SqlDataSource or other?
By default, when going through the GUI for the Grid control, the ID should be removed from view when "ReadOnly" is set to "True" and the Grid control will behave accordingly.
But it sounds like you have something a bit more custom going on that requires more information.
Can you post a code example of your data source and Grid control markup?

One suggestion is to make the TextBoxes disable in the Edit mode as follows.
C#:
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
((e.Item
is
GridEditableItem) && (e.Item.IsInEditMode))
{
GridEditableItem editItem = (GridEditableItem)e.Item;
TextBox TextBox1 = (TextBox)editItem[
"UniqueName"
].Controls[0];
//for boundcolumn
TextBox1.Enabled =
false
;
TextBox TextBox2 = (TextBox)editItem.FindControl(
"TextBoxID"
);
// for TextBox in EditItemTemplate
TextBox2.Enabled =
false
;
}
}
Thanks,
Shinu.

I'm using SQLData source
Here is the code
<telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="True"
CellSpacing="0" DataSourceID="E_RTH"
GridLines="None"
AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
AllowAutomaticUpdates="True"
AllowMultiRowEdit="True" ShowFooter="True" style="margin-right: 0px"
Width="696px" AutoGenerateHierarchy="True" Skin="Transparent">
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
<ExportSettings FileName="SpecialsEntry">
</ExportSettings>
<MasterTableView AutoGenerateColumns="False" DataSourceID="E_RTH"
ShowFooter="True" CommandItemDisplay="Bottom"
allowautomaticinserts="False" GroupLoadMode="Client"
AllowFilteringByColumn="True" AllowPaging="True" PageSize="20">
<CommandItemSettings ExportToPdfText="Export to PDF" AddNewRecordText="Add"
showaddnewrecordbutton="False" ShowRefreshButton="False"></CommandItemSettings>
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="Lab"
FilterControlAltText="Filter Lab column"
HeaderText="Lab " SortExpression="Lab"
UniqueName="Lab" AllowFiltering="False" AutoPostBackOnFilter="True"
ConvertEmptyStringToNull="False" MaxLength="2">
<HeaderStyle HorizontalAlign="Center" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Name"
FilterControlAltText="Filter Name column"
HeaderText="Name" SortExpression="Name"
UniqueName="Name" AllowFiltering="False">
<HeaderStyle HorizontalAlign="Center" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Break"
FilterControlAltText="Filter Break column" HeaderText="Break"
SortExpression="Break" UniqueName="Break"
DataType="System.Int32" AllowFiltering="False" ReadOnly="True"
Visible="False">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Head"
FilterControlAltText="Filter Head column" HeaderText="Head Count"
SortExpression="Head" UniqueName="Head"
DataType="System.Double" AllowFiltering="False">
<HeaderStyle HorizontalAlign="Center" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="P Per Station"
FilterControlAltText="Filter P Per Station column" HeaderText="P Per Station"
SortExpression="P Per Station" UniqueName="P Per Station"
DataType="System.Int32" ReadOnly="True" AllowFiltering="False"
Visible="False">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Ratio"
FilterControlAltText="Filter Ratio column"
HeaderText="Ratio" AllowFiltering="False"
SortExpression="Ratio" UniqueName="Ratio"
DataType="System.Double" Display="False" ReadOnly="True" Visible="False"
AllowSorting="False" Groupable="False" Reorderable="False" Resizable="False"
ShowSortIcon="False" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn AllowFiltering="False" DataField="Week"
DataType="System.DateTime"
FilterControlAltText="Filter Week column"
HeaderText="Week Ending Date" SortExpression="Week"
UniqueName="Week">
<HeaderStyle HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="Center" />
</telerik:GridBoundColumn>
<telerik:GridEditCommandColumn UniqueName="EditCommandColumn"
ButtonType="ImageButton" EditImageUrl="images/edit.png"
UpdateImageUrl="images/update.png">
</telerik:GridEditCommandColumn>
</Columns>
<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn" ButtonType="ImageButton" UpdateImageUrl="Images/update2.png" CancelImageUrl="Images/cancel.png" Visible="True">
</EditColumn>
</EditFormSettings>
</MasterTableView>
<ClientSettings>
<DataBinding EnableCaching="True">
</DataBinding>
<Resizing AllowResizeToFit="true" />
<Animation ColumnReorderAnimationDuration="20"
ColumnRevertAnimationDuration="20" />
</ClientSettings>
<FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>
<asp:SqlDataSource ID="E_RTH" runat="server"
ConnectionString="<%$ ConnectionStrings:E_Constants_Rth %>"
SelectCommand="USP_Specials_Sel_HeadC"
SelectCommandType="StoredProcedure"
UpdateCommand="USP_Specials_UPD_HeadC"
UpdateCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="InvoiceDate" Name="Week"
PropertyName="SelectedValue" Type="DateTime" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="Week" Type="DateTime" />
<asp:Parameter Name="Lab" Type="String" />
<asp:Parameter Name="Head" Type="Double" />
<asp:Parameter Name="Name" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SpecUnits" runat="server"
ConnectionString="<%$ ConnectionStrings:Specials %>"
SelectCommand="USP_Specials_SelbyDateView"
DeleteCommand="USP_Specials_Del" DeleteCommandType="StoredProcedure"
InsertCommand="USP_Specials_Order_Ins" InsertCommandType="StoredProcedure"
SelectCommandType="StoredProcedure" UpdateCommand="USP_Specials_Upd_HeadC"
UpdateCommandType="StoredProcedure" >
<SelectParameters>
<asp:ControlParameter ControlID="InvoiceDate" Name="WeekEndingDate"
PropertyName="SelectedValue" Type="DateTime" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="Lab" Type="String" />
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="Break" Type="Decimal" />
<asp:Parameter Name="Ratio" Type="String" />
<asp:Parameter Name="P Per Station" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="Lab" Type="String" />
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="Break" Type="Decimal" />
<asp:Parameter Name="Ratio" Type="String" />
<asp:Parameter Name="P Per Station" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</div>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="1"
UpdatePanelRenderMode="Inline" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
Shinu,
I've tried that but I'm getting an error (See attached), sorry I'm not really good on telerik, still learning

Your RadGrid does not have the ID column in it.
By default, your procs must pass the ID column into the RadGrid, and your RadGrid must store it in a column so that the radgrid can pass the ID column back to the proc to ensure the correct row of data is being edited (you do not have an ID column of any kind). You can usually set this to ReadOnly=True, Visible=False and it should work.
Unfortunately, I cannot see your proc or table structure so I am unable to produce a test environment.
Would you be able to provide the proc and table syntax?
Do go with the approach Shinu has pointed to. The error you are getting is due to your including the System.Window.Forms namescape in the code-behind of your aspx. Just replace it with System.Web.UI.WebControls.
Hope it helps.
Regards,
Tsvetoslav
the Telerik team

And
name = @ame

@Tsvetoslav
THAT WORKS !!! Great stuff!
Thanks!
@Casey
That was a typo on my end :)
Thanks