| If (Not RadGrid1.MasterTableView.Items.Count = 0) Then |
| With RadGrid1 |
| .ExportSettings.IgnorePaging = True |
| .ExportSettings.ExportOnlyData = True |
| .ExportSettings.FileName = "ExportedResult" |
| .MasterTableView.ExportToExcel() |
| End With |
| End If |
if i'll remove the line " ExportSettings.IgnorePaging = True" , it will work. but i need all the pages to be exported.
in aspx, i am used the code like bellow
| <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AutoGenerateColumns="true" |
| DataSourceID="sqlData1" EnableEmbeddedSkins="False" GridLines="None" |
| EnableAJAX="True" > |
| <HeaderContextMenu EnableTheming="True"> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </HeaderContextMenu> |
| <MasterTableView DataSourceID="sqlData1" AllowFilteringByColumn="false" PageSize="50"> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <Columns> |
| </Columns> |
| </MasterTableView> |
| <FilterMenu EnableTheming="True"> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </FilterMenu> |
| </telerik:RadGrid> |
| <asp:SqlDataSource ID="sqlData1" runat="server" ConnectionString="<%$ ConnectionStrings:PAMMSConnectionString %>"> |
| </asp:SqlDataSource> |
My grid is creating Dynamically, thats why i used " AutoGenerateColumns="true" ". According to the query user gives , the grid will populate the data.
can you please help me out for this issue.
I've got a RadGrid that contains multiple DataList in a template column, most all the values are numeric, but not all. I can export to excel, and most everything is correct, however in my situation, I need different formats for the cells, depending on the datalist.
This is my export secion
| gv.ExportSettings.FileName = Format(Now(), "MMddyyyy") |
| gv.ExportSettings.IgnorePaging = True |
| gv.ExportSettings.ExportOnlyData = False |
| gv.ExportSettings.OpenInNewWindow = True |
| gv.ExportSettings.HideStructureColumns = True |
| gv.MasterTableView.ExportToExcel() |
| AddHandler gv.ExcelExportCellFormatting, AddressOf Me.gv_ExcelExportCellFormatting |
I can get the individual datalist in this event, but how do I apply a specific format to the Cells within the Datalist whenexported to Excel?
Hopefully I've provided enough info to get some assistance here, of not let me know and I'll try respond with additional info.
Thanks in Advance
| <ClientSettings AllowExpandCollapse="True"> |
| <ClientEvents OnHierarchyCollapsed="Collapsed" /> |
| <ClientEvents OnHierarchyExpanded="Expanded" /> |
| </ClientSettings> |
| <script type="text/javascript" language="javascript"> |
| function Collapsed(sender, eventArgs) { |
| var radgrid = sender; |
| var detailTablesArray = radgrid.get_detailTables(); |
| document.getElementById(detailTablesArray[eventArgs.get_itemIndexHierarchical()]._data.ClientID).style.display = "none"; |
| } |
| function Expanded(sender, eventArgs) { |
| var radgrid = sender; |
| var detailTablesArray = radgrid.get_detailTables(); |
| document.getElementById(detailTablesArray[eventArgs.get_itemIndexHierarchical()]._data.ClientID).style.display = "inline"; |
| } |
| </script> |
It disappeared so I had to use this:
| if (e.Item is GridGroupFooterItem) |
| { |
| GridGroupFooterItem groupedItem = e.Item as GridGroupFooterItem; |
| groupedItem.Style["width"] = "20px"; |
| groupedItem.Style["height"] = "20px"; |
| groupedItem.Style["background-color"] = "lightgray"; |
| groupedItem.Style["font-size"] = "11px"; |
| groupedItem.Style["font-family"] = "Verdana"; |
| groupedItem.Style["text-align"] = "right"; groupedItem.Style["font-weight"] = "bold"; |
| groupedItem.Style["vertical-align"] = "text-top"; } |
| <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server"> |
| <AjaxSettings> |
| <telerik:AjaxSetting AjaxControlID="rgEntries"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="rgEntries" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| [cut] |
| </AjaxSettings> |
| </telerik:RadAjaxManagerProxy> |
| <telerik:RadGrid ID="rgEntries" runat="server" AllowPaging="True" |
| AllowSorting="True" GridLines="None" ShowFooter="True" ShowStatusBar="True" AllowCustomPaging="True" AutoGenerateColumns="False" |
| OnNeedDataSource="rgEntries_NeedDataSource" OnDeleteCommand="rgEntries_DeleteCommand" OnInsertCommand="rgEntries_InsertCommand" OnUpdateCommand="rgEntries_UpdateCommand" OnItemCommand="rgEntries_ItemCommand"> |
| <ExportSettings IgnorePaging="True" OpenInNewWindow="True" ExportOnlyData="True" filename="TimeEntriesExport" > |
| <Pdf Title="Time Entries Export" PaperSize="A4" PageWidth="297mm" PageHeight="210mm"></Pdf> |
| </ExportSettings> |
| <MasterTableView CommandItemDisplay="Top" DataKeyNames="ID" AllowCustomSorting="True" EditMode="EditForms"> |
| <CommandItemSettings ShowExportToExcelButton="True" ShowExportToWordButton="True" ShowExportToCsvButton="True"></CommandItemSettings> |
| <Columns> |
| <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn> |
| [cut] |
| </Columns> |
| <EditFormSettings EditFormType="WebUserControl" UserControlName="Controls\TimeEntryDetails.ascx"> |
| <EditColumn UniqueName="EditCommandColumn1"></EditColumn> |
| </EditFormSettings> |
| </MasterTableView> |
| <ClientSettings AllowDragToGroup="True"> |
| <Selecting AllowRowSelect="True"></Selecting> |
| <ClientEvents OnRowDblClick="RowDblClick"></ClientEvents> |
| </ClientSettings> |
| <HeaderContextMenu EnableAutoScroll="True"> |
| </HeaderContextMenu> |
| </telerik:RadGrid> |
| protected void rgEntries_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) |
| { |
| int? totals = null; |
| EntryCollection entries = GetEntries(ref totals, rgEntries.CurrentPageIndex); |
| rgEntries.DataSource = entries; |
| rgEntries.VirtualItemCount = totals.Value; |
| } |
| protected void rgEntries_UpdateCommand(object source, GridCommandEventArgs e) |
| { |
| bool moveNext = true; |
| CRMAdmin.Controls.TimeEntryDetails userControl = |
| (CRMAdmin.Controls.TimeEntryDetails)e.Item.FindControl(GridEditFormItem.EditFormUserControlID); |
| Entry entry = |
| CRMService.Default.Repository.Fetch<Entry>( |
| (Guid)rgEntries.MasterTableView.DataKeyValues[e.Item.ItemIndex]["ID"], false); |
| userControl.LoadToObject(entry); |
| if (!entry.IsDirty) |
| { |
| if (moveNext) |
| { |
| if (e.Item.ItemIndex < rgEntries.Items.Count - 1) |
| { |
| rgEntries.Items[e.Item.ItemIndex + 1].Edit = true; |
| } |
| else |
| { |
| rgEntries.CurrentPageIndex++; |
| rgEntries.Items[0].Edit = true; |
| } |
| } |
| return; //nothing changed |
| } |
| ValidationResults val = entry.Validate(); |
| if (val.IsValid) |
| { |
| try |
| { |
| using (TransactionScope scope = new TransactionScope()) |
| { |
| string userName = System.Web.HttpContext.Current != null ? System.Web.HttpContext.Current.User.Identity.Name : string.Empty; |
| entry.Save(userName); |
| scope.Complete(); |
| } |
| if (moveNext) |
| { |
| if (e.Item.ItemIndex < rgEntries.Items.Count - 1) |
| { |
| rgEntries.Items[e.Item.ItemIndex + 1].Edit = true; |
| } |
| else |
| { |
| rgEntries.CurrentPageIndex++; |
| rgEntries.Items[0].Edit = true; |
| } |
| } |
| } |
| catch (Exception ex) |
| { |
| Label lblError = new Label(); |
| lblError.Text = "Unable to update Time Entry. Reason: " + ex.Message; |
| lblError.ForeColor = System.Drawing.Color.Red; |
| rgEntries.Controls.Add(lblError); |
| e.Canceled = true; |
| } |
| } |
| else |
| { |
| Validator validator = new Validator(); |
| validator.IsValid(entry as IRepositoryRecord); |
| rgEntries.Controls.Add(validator); |
| e.Canceled = true; |
| } |
| } |
| <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1" SelectedIndex="0" ShowBaseLine="True" EnableViewState="false"> |
| <Tabs> |
| <telerik:RadTab runat="server" Text="Common" Selected="True"></telerik:RadTab> |
| <telerik:RadTab runat="server" Text="Other" Value="Other"></telerik:RadTab> |
| <telerik:RadTab runat="server" Text="Audit History" Value="AuditHistory"></telerik:RadTab> |
| </Tabs> |
| </telerik:RadTabStrip> |
| <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" ScrollBars="None" EnableViewState="true"> |
| <telerik:RadPageView ID="rpvCommon" runat="server"> |
| [cut] |
| </telerik:RadPageView> |
| </telerik:RadMultiPage> |
| <asp:button id="btnUpdate" text="Update & Next" runat="server" CommandName="Update" Visible='<%# !(DataItem is Telerik.Web.UI.GridInsertionObject) %>'></asp:button> |
| protected Object _dataItem = new object(); |
| public object DataItem |
| { |
| get { return this._dataItem; } |
| set { this._dataItem = value; } |
| } |
| protected override void OnDataBinding(EventArgs e) |
| { |
| base.OnDataBinding(e); |
| //setup control values from DataItem |
| [cut] |
| } |
Hi All, I am following the Load on Demand RadPageView example and everything is working correctly except for the fact that I am trying to load PageIndex 2 and show PageIndex 2. When I do this the tab shows up blank as if nothing was loaded. I believe the actual tab is loading but at index 0, any guidance or a how to will be much appreciated.
Thanks
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
AddTab(
"General Information");
AddTab(
"Change Password");
AddTab(
"Quick Links");
AddTab(
"Application Access");
int i = -1;
if (Request.QueryString["PageIndex"] != null)
Int32.TryParse(Request.QueryString["PageIndex"], out i);
switch (i)
{
case 2:
RadMultiProfile.SelectedIndex = 2;
RadTabProfile.SelectedIndex = 2;
AddPageView(RadTabProfile.FindTabByText(
"Quick Links"));
 
break;
default:
AddPageView(RadTabProfile.FindTabByText(
"General Information"));
break;
}
 
}
}
private void AddTab(string tabName)
{
RadTab tab = new RadTab();
tab.Text = tabName;
RadTabProfile.Tabs.Add(tab);
}
private void AddPageView(RadTab tab)
{
RadPageView pageView = new RadPageView();
pageView.ID = tab.Text;
RadMultiProfile.PageViews.Add(pageView);
tab.PageViewID = pageView.ID;
}
protected void RadTabProfile_TabClick(object sender, RadTabStripEventArgs e)
{
AddPageView(e.Tab);
e.Tab.PageView.Selected =
true;
}
protected void RadMultiProfile_PageViewCreated(object sender, RadMultiPageEventArgs e)
{
string userControlName = "Controls/" + e.PageView.ID.Replace(" ", "") + ".ascx";
Control userControl = Page.LoadControl(userControlName);
userControl.ID = e.PageView.ID +
"_userControl";
e.PageView.Controls.Add(userControl);
}