In some scenarios you may want to get a hold on the auto-generated action buttons (update/insert/cancel) inside the auto-generated grid edit form (EditMode = InPlace or EditForms) and modify them a bit without changing the entire layout of the edit form (which is possible with WebUserControl or FormTemplate custom edit form). Here are the steps to accomplish this task programmatically with several lines of code:
Subscribe to the ItemCreated event of RadGrid
Check whether the currently created item is in edit or insert mode
Find the button of interest by its id (UpdateButton, PerformInsertButton or CancelButton) and alter its setting in par with your preferences
Below is a simple example which changes the text and some of the styles for those buttons:
ASP.NET
<telerik:RadGridRenderMode="Lightweight"ID="RadGrid1"runat="server"DataSourceID="SqlDataSource1"AllowSorting="True"Skin="Office2007"GridLines="None"Width="95%"><MasterTableViewWidth="100%"DataKeyNames="CustomerID"CommandItemDisplay="Top"AutoGenerateColumns="false"><Columns><telerik:GridBoundColumnUniqueName="CompanyName"DataField="CompanyName"HeaderText="Company name"/><telerik:GridBoundColumnUniqueName="ContactName"DataField="ContactName"HeaderText="Contact name"/><telerik:GridBoundColumnUniqueName="ContactTitle"DataField="ContactTitle"HeaderText="Contact title"/><telerik:GridEditCommandColumn/></Columns></MasterTableView></telerik:RadGrid><asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"SelectCommand="SELECT * FROM [Customers]"></asp:SqlDataSource>
VB
ProtectedSub RadGrid1_ItemCreated(ByVal sender AsObject,ByVal e As Telerik.Web.UI.GridItemEventArgs)Handles RadGrid1.ItemCreated
IfTypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode ThenIfNot e.Item.OwnerTableView.IsItemInserted ThenDim updateButton As LinkButton =CType(e.Item.FindControl("UpdateButton"), LinkButton)
updateButton.Text="Update record"
updateButton.Style("font-size")="12px"
updateButton.Style("font-weight")="bold"
updateButton.Style("color")="blue"ElseDim insertButton As LinkButton =CType(e.Item.FindControl("PerformInsertButton"), LinkButton)
insertButton.Text="Insert record"
insertButton.Style("font-size")="12px"
insertButton.Style("font-weight")="bold"
insertButton.Style("color")="blue"EndIfDim cancelButton As LinkButton =CType(e.Item.FindControl("CancelButton"), LinkButton)
cancelButton.Text="Cancel editing"
cancelButton.Style("font-size")="12px"
cancelButton.Style("font-weight")="bold"
cancelButton.Style("color")="blue"EndIfEndSub