or
RadGrid1.MasterTableView.ExportToExcel(). I am using MS office 2010. Before excel is opened, it always popups a warning that says the file format is not correct. It seems that ExportToExcel() creates a .xls file, while excel 2010 default is .xlsx file. I wonder if there is way for ExportToExcel() to generate a .xls file. Thanks. protected void RadGrid1_ExportCellFormatting(object sender, ExportCellFormattingEventArgs e){ GridDataItem item1 = e.Cell.Parent as GridDataItem; if (e.FormattedColumn.UniqueName == "UniqueName") { TableCell cell = item["UniqueName"]; cell.Style["background-color"] = "Red"; }}
Dim responseScript As String = String.Format("var secondCombo = $find['{0}'];var firstCombo = $find['{1}'];SecondComboInitialize();", e.Item.FindControl("cboActiveNormDoc").ClientID, e.Item.FindControl("cboNormDocStatus").ClientID)
<telerik:GridTemplateColumn HeaderText="Address" UniqueName="Address" ItemStyle-Width="20"> <ItemTemplate> <a href='<%# Eval("Address") %>' title='<%# Eval("Address") %>'><img src="images/go.gif" border="0" width="33"></a> </ItemTemplate></telerik:GridTemplateColumn >Dim item As GridDataItem = CType(e.Item, GridDataItem)If condition Then item("Address").Controls(0).Visible = FalseEnd IfRadGrid1.ExportSettings.IgnorePaging = true; (or false)RadGrid1.ExportSettings.OpenInNewWindow = false;RadGrid1.ExportSettings.ExportOnlyData = true;private void CreateMenuByUser() { RadMenu1.Visible = true; DataTable table = GetDataTable("SELECT * FROM UserRights INNER JOIN Users ON UserRights.UserID = Users.UserID WHERE Users.UserID = '" + Session["UserID"] + "'"); //RadMenuItemCollection menuItems = RadMenu1.Items; RadMenuItem disabledItems = new RadMenuItem(); foreach (DataRow item in table.Rows) { if (bool.Parse(item["rRead"].ToString()) == false) { foreach (RadMenuItem menuItem in RadMenu1.Items)-->>>this line cause the error Index was out of the range error { if (menuItem.Value == item["MenuID"].ToString()) disabledItems = menuItem; if (menuItem.Items.Count > 0) GetAllChildItems(menuItem, item["MenuID"].ToString()); } RadMenu1.Items.Remove(disabledItems); } } }
{ RadMenuItemCollection menuItems = itemsList.Items; RadMenuItem disabledItems = new RadMenuItem(); foreach (RadMenuItem menuItem in itemsList.Items) { if (menuItem.Value == MenuId) disabledItems = menuItem; } menuItems.Remove(disabledItems); }