or
protected void radGrid_ColumnCreated(object sender, GridColumnCreatedEventArgse){ e.Column.HeaderStyle.Width = 200; e.Column.ItemStyle.Width = 200; e.Column.HeaderText = "test"; e.Column.UniqueName = "test2"}protected void radGrid_ItemDataBound(object sender, GridItemEventArgs e){ //Set column Width and Height and also the columns Header text and Unique name. }Telerik.Web.UI.RadGrid.prototype.showEditItemForm = function (itemIndex) { this.gridItemIndex = itemIndex; $find(this.windowId).show(); __doPostBack(this.panelId, itemIndex); return false;}Telerik.Web.UI.RadGrid.prototype.saveChanges = function () { if (this.gridItemIndex > -1) this.get_masterTableView().fireCommand('Update', ''); else this.get_masterTableView().fireCommand('PerformInsert', '');}void pnlWnd_PreRender(object sender, EventArgs e) { //Handle updatepanel postback, show edit window string eventTarget = HttpContext.Current.Request.Params["__EVENTTARGET"] as string; int eventArg = -1; if (!string.IsNullOrEmpty(eventTarget) && eventTarget == pnlWnd.ClientID && int.TryParse(HttpContext.Current.Request.Params["__EVENTARGUMENT"], out eventArg)) { //CreateEditWindow(); editWindowContainer.Visible = true; if (eventArg > -1) { GridCommandEventArgs args = new GridCommandEventArgs(this.Items[eventArg], this, new CommandEventArgs(RadGrid.EditCommandName, null)); OnItemCommand(args); } else { MasterTableView.IsItemInserted = true; GridCommandEventArgs args = new GridCommandEventArgs(MasterTableView.GetItems(GridItemType.CommandItem)[0], this, new CommandEventArgs(InitInsertCommandName, -1)); OnItemCommand(args); } } }<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"> <script type="text/javascript"> function OnClientClickingApprovedLocations(sender, args) { var callBackFunction2 = Function.createDelegate(sender, function (argument) { if (argument) { this.click(); } }); var Master = $find("<%=rgRequestorlocations.ClientID %>").get_masterTableView(); var SelectedItem = Master.get_selectedItems()[0]; var location_name = SelectedItem.getDataKeyValue("location_name"); // get the DataKeyValue of selected item var role = SelectedItem.getDataKeyValue("role"); var duty = SelectedItem.getDataKeyValue("duty"); if (duty == "P") { if (role == "Privacy Officer") { roletext = "Are you sure you want to remove this role location?"; radconfirm(roletext, callBackFunction2, 300, 100, null, "Delete"); args.set_cancel(true); } else { roletext = "Please confirm the Primary " + role + " for " + location_name + " will be removed " + "" + "?"; radconfirm(roletext, callBackFunction2, 300, 100, null, "Delete"); args.set_cancel(true); } } else { roletext = "Are you sure you want to remove this role location?"; radconfirm(roletext, callBackFunction2, 300, 100, null, "Delete"); args.set_cancel(true); } } </script> </telerik:RadScriptBlock><telerik:RadGrid ID="rgRequestorlocations" runat="server" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" OnNeedDataSource="rgRequestorlocations_NeedDataSource" OnItemCommand="rgRequestorlocations_ItemCommand" OnItemDataBound="rgRequestorlocations_ItemDataBound"> <MasterTableView DataKeyNames="location_pk, user_id, role,location_name, duty" ClientDataKeyNames="location_pk, user_id, role,location_name, duty"> <CommandItemSettings ExportToPdfText="Export to PDF" /> <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True"> <HeaderStyle Width="20px" /> </RowIndicatorColumn> <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True"> <HeaderStyle Width="20px" /> </ExpandCollapseColumn> <Columns> <telerik:GridBoundColumn DataField="user_id" FilterControlAltText="Filter location_pk column" HeaderText="User ID" UniqueName="user_id" Visible="False"></telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="location_pk" FilterControlAltText="Filter location_pk column" HeaderText="Location ID" UniqueName="location_pk" Visible="False"></telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="location_name" FilterControlAltText="Filter location_name column" HeaderText="Location Name" UniqueName="location_name"></telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="role" FilterControlAltText="Filter role column" HeaderText="Role" UniqueName="role"></telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="duty" FilterControlAltText="Filter role column" HeaderText="duty" UniqueName="duty" Visible="false"></telerik:GridBoundColumn> <%-- <telerik:GridButtonColumn ButtonType="PushButton" FilterControlAltText="Filter deletecolumn column" ConfirmText="Are you sure you want to remove this role location?" ConfirmDialogType="RadWindow" ConfirmTitle="Remove Role Location?" HeaderText="Remove Role" Text="Remove Role" UniqueName="deletecolumn" CommandName="DeleteRoleLocation"> </telerik:GridButtonColumn>--%> <telerik:GridTemplateColumn UniqueName="rbDelete"> <ItemTemplate> <telerik:RadButton ID="rbDelete" onr runat="server" Text="Remove Role" OnClientClicking="OnClientClickingApprovedLocations" Value="" CommandName="DeleteRoleLocation"> </telerik:RadButton> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> <EditFormSettings> <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn> </EditFormSettings> <PagerStyle PageSizeControlType="RadComboBox" /> </MasterTableView> <PagerStyle PageSizeControlType="RadComboBox" /> <ClientSettings> <Selecting AllowRowSelect="True"></Selecting> </ClientSettings> <FilterMenu EnableImageSprites="False"></FilterMenu> </telerik:RadGrid>
