or
Telerik.Web.UI.Editor.CommandList["BackgroundImage"] = function (commandName, editor, commandArgs) { var argument = Telerik.Web.UI.Editor.CommandList._getLinkArgument(editor); Telerik.Web.UI.Editor.CommandList._getDialogArguments(argument, "A", editor, commandName); var callbackFunction = Telerik.Web.UI.Editor.CommandList.getCallbackFunction(commandArgs, function (sender, args) { if (!args) { //alert("No args!"); return false; } var selectedItem = args.get_value(); var path = args.value.getAttribute("src", 2); var style = editor.get_contentArea().style; style.backgroundImage = 'url(' + path + ')'; document.getElementById('<%=hdnBackgroundImage.ClientID %>').value = path; }); editor.showDialog("backgroundImageManager", argument, callbackFunction); return false; };
<telerik:RadGrid ID="CustomerList" runat="server" GroupingEnabled="False" ShowStatusBar="True" OnPreRender="CustomerList_PreRender" DataSourceID="CustomerDataSource" OnItemCommand="CustomerList_ItemCommand" OnItemDataBound="CustomerList_ItemDataBound" OnInsertCommand="CustomerList_InsertCommand" OnItemInserted="CustomerList_ItemInserted" OnItemEvent="CustomerList_ItemEvent" > <MasterTableView DataKeyNames="CustomerId" DataSourceID="CustomerDataSource" AllowPaging="true" AutoGenerateColumns="False" GridLines="None" EditMode="PopUp" ShowFooter="True" InsertItemDisplay="Bottom" CommandItemDisplay="TopAndBottom" > <CommandItemSettings AddNewRecordText="Add Customer" /> <Columns> <telerik:GridBoundColumn DataField="CustomerId" DataType="System.Int32" FilterControlAltText="Filter CustomerId column" HeaderText="CustomerId" ReadOnly="True" SortExpression="CustomerId" UniqueName="CustomerId"> <ColumnValidationSettings> <ModelErrorMessage Text="" /> </ColumnValidationSettings> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="CustomerName" FilterControlAltText="Filter CustomerName column" HeaderText="CustomerName" SortExpression="CustomerName" UniqueName="CustomerName"> <ColumnValidationSettings> <ModelErrorMessage Text="" /> </ColumnValidationSettings> </telerik:GridBoundColumn> <telerik:GridEditCommandColumn UniqueName="EditCommandColumn"> <ItemStyle Width="20px" Font-Underline="true" /> </telerik:GridEditCommandColumn> </Columns> <NoRecordsTemplate> No customers have been created yet. </NoRecordsTemplate> <EditFormSettings EditFormType="WebUserControl" CaptionDataField="CustomerName" UserControlName="~/UserControls/CustomerEditor.ascx" > <EditColumn UniqueName="EditCommandColumn" HeaderButtonType="TextButton"> </EditColumn> <PopUpSettings ScrollBars="None" Width="581"/> </EditFormSettings> <PagerStyle Mode="NextPrevAndNumeric" Position="Bottom" /> </MasterTableView></telerik:RadGrid>
