This is a migrated thread and some comments may be shown as answers.

IgnorePaging=true not working on expot to excel

8 Answers 491 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Computer Surgeon
Top achievements
Rank 1
Computer Surgeon asked on 03 Jul 2009, 02:19 PM
Hi there,

                I export the radgrid to excel. Using the following code...
 <ExportSettings FileName="Program_Accounts" OpenInNewWindow="true"  IgnorePaging="true"></ExportSettings>

RadGrid1.ExportSettings.ExportOnlyData = true;
RadGrid1.ExportSettings.IgnorePaging = true;
RadGrid1.ExportSettings.OpenInNewWindow = true;

This RadGrid1.ExportSettings.IgnorePaging = true is not exporting all the pages to excel. i can't figure out why?. While binding the grid all the records gets binded.

Is there any scenario only first page alone will be exported even after specifing IgnorePaging = true on design and codebehind

Please help me why after giving IgnorePaging = true its not exporting all the records in the grid.


Thanks!.

8 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 03 Jul 2009, 04:02 PM
Hello,

Attached to this message is a simple runnable application that demonstrates the needed approach. Please give it a try and let me know what is the difference in your scenario.

I hope this helps.

All the best,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jason
Top achievements
Rank 1
answered on 09 Oct 2009, 12:18 PM
I had this same problem but just figured it out. This wasn't an issue in older versions of the grid, just started happening once we upgraded. I was binding my grid on Page Prerender, so I guess when the data gets rebinded after the export, it doesn't ignore the paging. Once I moved the binding to Page Load (before the button handler runs), it worked as expected.
0
Ravish
Top achievements
Rank 1
answered on 09 Mar 2011, 11:09 PM
Hi,

while exporting i am not getting complete dataset in excel file it only transfers active page to excel. I checked the attachment in previous response and its similar to what i have. Also i have template columns with textboxes and drop downs whose values are defined in item data bound event. those columns are also not getting there content exported.

Please suggest,
Thanks,
Ravish
0
Princy
Top achievements
Rank 2
answered on 10 Mar 2011, 05:43 AM
Hello Ravish,

The code is working on my end when I am using AdvancedDataBinding. Please check whether you are using Simple Data Binding to populate the grid. If that the case I suggest you to use Grid / Advanced Data Binding (using NeedDataSource event) to get the complete grid items when exporting.

Could you please paste the complete code for further assistance?

Thanks,
Princy.
0
Ravish
Top achievements
Rank 1
answered on 14 Mar 2011, 09:21 PM
Hi,

I implemented NeedDatasource Event for the Grid and it returns Object Reference Error while exporting the data. Please find below the aspx and code behind file for your reference.

ASPX Code Snippet:

<

 

telerik:RadGrid ID="grdQoSAttributes" runat="server" AllowPaging="True" AllowSorting="True" OnItemUpdated="grdQoSAttributes_ItemUpdated"

 

 

PageSize="20" AllowFilteringByColumn="True" GridLines="Both" OnItemDataBound="grdQoSAttributes_ItemDataBound"

 

 

OnSortCommand="grdQoSAttributes_SortCommand" OnPageIndexChanged="grdQoSAttributes_PageIndexChanged" OnNeedDataSource="grdQoSAttributes_NeedDataSource"

 

 

AllowAutomaticUpdates="true" AutoGenerateColumns="False">

 

 

<headercontextmenu cssclass="GridContextMenu GridContextMenu_Default"></headercontextmenu>

 

 

<itemstyle wrap="false" />

 

 

<mastertableview allowmulticolumnsorting="true" tablelayout="Fixed">

 

 

<

 

CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>

 

 

<

 

RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>

 

 

<

 

ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>

 

 

<Columns>

 

 

<telerik:GridBoundColumn SortExpression="Destination"

 

 

 

DataField="Destination" AllowFiltering="true"

 

 

AllowSorting="true" HeaderText="Destination">

 

 

<

 

HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="400px"></HeaderStyle>

 

 

<ItemStyle Width="400px" />

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridTemplateColumn SortExpression="TerminatingTraffic" DataField="TerminatingTraffic"

 

 

HeaderText="Terminating Traffic">

 

 

<

 

HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="120px"></HeaderStyle>

 

 

<ItemStyle Width="120px" HorizontalAlign="Center" VerticalAlign="Middle" />

 

 

<ItemTemplate>

 

 

<telerik:RadComboBox ID="ddlTerminating" runat="server" Width="100px" OnSelectedIndexChanged="RowChanged" >

 

 

</telerik:RadComboBox>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn><telerik:GridTemplateColumn SortExpression="CLI" DataField="CLI" HeaderText="CLI"

 

 

>

 

 

<

 

HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="120px"></HeaderStyle>

 

 

<ItemStyle Width="120px" HorizontalAlign="Center" VerticalAlign="Middle" />

 

 

<ItemTemplate>

 

 

<telerik:RadComboBox ID="ddlCLI" runat="server" CssClass="ddlCLI" Width="100px" OnSelectedIndexChanged="RowChanged">

 

 

</telerik:RadComboBox>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridTemplateColumn SortExpression="ASR" DataField="ASR" HeaderText="ASR">

 

 

<

 

HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="120px"></HeaderStyle>

 

 

<ItemStyle Width="120px" HorizontalAlign="Center" VerticalAlign="Middle" />

 

 

<ItemTemplate>

 

 

<telerik:RadNumericTextBox ID="txtASR" runat="server" Width="100px" MinValue="0"

 

 

MaxValue="100" Type="Number" OnTextChanged="RowChanged">

 

 

<NumberFormat DecimalDigits="0" GroupSeparator="" />

 

 

</telerik:RadNumericTextBox></ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridTemplateColumn SortExpression="ALOC" DataField="ALOC" HeaderText="ALOC">

 

 

<

 

HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="120px"></HeaderStyle>

 

 

<ItemStyle Width="120px" HorizontalAlign="Center" VerticalAlign="Middle" />

 

 

<ItemTemplate>

 

 

<telerik:RadNumericTextBox ID="txtALOC" runat="server" Width="100px" Type="Number" OnTextChanged="RowChanged">

 

 

 

</telerik:RadNumericTextBox></ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridTemplateColumn SortExpression="NER" DataField="NER" HeaderText="NER">

 

 

<

 

HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="120px"></HeaderStyle>

 

 

<ItemStyle Width="120px" HorizontalAlign="Center" VerticalAlign="Middle" />

 

 

<ItemTemplate>

 

 

<telerik:RadNumericTextBox ID="txtNER" runat="server" Width="100px" Type="Percent" OnTextChanged="RowChanged">

 

 

</telerik:RadNumericTextBox></ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridBoundColumn Visible="false" DataField="DestinationID" ></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn Visible="false" DataField="ALOC" HeaderText="ALOC"></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn Visible="false" DataField="CLI" HeaderText="CLI"></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn Visible="false" DataField="ASR" HeaderText="ASR"></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn Visible="false" DataField="NER" HeaderText="NER"></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn Visible="false" DataField="TerminatingTraffic" HeaderText="TerminatingTraffic"></telerik:GridBoundColumn>

 

 

</Columns>

 

 

<

 

EditFormSettings>

 

 

<

 

EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>

 

 

</

 

EditFormSettings>

 

 

<

 

PagerStyle AlwaysVisible="True"></PagerStyle>

 

 

</mastertableview>

 

 

<pagerstyle alwaysvisible="true" mode="NumericPages" />

 

 

<filtermenu enableimagesprites="False"></filtermenu>

 

 

</telerik:RadGrid>

Code Base:

 

 

public

 

partial class QoSEntry : BasePage

 

 

 

 

 

 

 

{

 

 

 

public string PageMethodUrl { get; set; }

 

 

 

 

protected void Page_Load(object sender, EventArgs e)

 

 

{

 

 

 

try

 

 

 

 

 

 

 

{

 

PageMethodUrl = Page.ResolveUrl(

 

"~/QoSEntry.aspx/GetResponse");

 

 

 

 

Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(HttpContext.Current.Request.UserLanguages[0]);

 

 

 

 

if (!Page.IsPostBack)

 

 

{

 

 

 

if (!string.IsNullOrEmpty(Request.QueryString["UserID"]))

 

 

hdnUserID.Value = Request.QueryString[

 

"UserID"].ToString();

 

 

 

 

else

 

 

 

 

 

 

 

 

 

throw new Exception("Session Expired");

 

 

 

 

if (hdnSession.Value != "")

 

 

hdnSession.Value = System.

 

Guid.NewGuid().ToString();

 

 

txtSelDate.Text =

 

DateTime.Today.ToShortDateString();

 

 

 

 

string strControl = "txtSelDate";

 

 

 

 

string strDateFormat = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;

 

 

 

 

string strTimeFormat = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.LongTimePattern;

 

 

 

 

string strDateSeperator = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.DateSeparator;

 

 

 

 

string strTimeSeperator = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.TimeSeparator;

 

 

 

 

string strLostFocus = "fnLostFocus('" + strDateFormat + "','" + strDateSeperator + "','" + strTimeFormat + "','" + strTimeSeperator + "','" + strControl + "');";

 

 

txtSelDate.Attributes.Add(

 

"onblur", strLostFocus);

 

 

imgGo.Attributes.Add(

 

"OnClick", "return fnValidate();");

 

 

BindQoS();

 

}

 

}

 

 

 

catch (Exception ex)

 

 

{

 

 

 

string str = ex.Message;

 

 

}

 

}

 

 

 

public void BindQoS()

 

 

{

 

 

 

Queue<EntityKVP> quSource = new Queue<EntityKVP>();

 

 

quSource =

 

Source.GetSourceBySourceTypeID(Convert.ToInt32(SourceType.QualityofService));

 

 

 

 

List<EntityKVP> lst = quSource.ToList<EntityKVP>();

 

 

lst.Insert(0,

 

new EntityKVP()

 

 

{

 

Name =

 

"Select Quality of Service",

 

 

ID = -999

 

});

 

ddlQoS.DataSource = lst;

 

ddlQoS.DataTextField =

 

"Name";

 

 

ddlQoS.DataValueField =

 

"ID";

 

 

ddlQoS.DataBind();

 

}

 

[

 

WebMethod]

 

 

 

 

public static List<iXTools.iXTrade.Entities.QualityofService> GetData(int startIndex, int maximumRows, Queue<iXTools.iXTrade.Entities.QualityofService> _masterQoS)

 

 

{

 

 

 

List<iXTools.iXTrade.Entities.QualityofService> lstQoS = new List<iXTools.iXTrade.Entities.QualityofService>();

 

 

 

 

return lstQoS;

 

 

}

 

 

 

protected void imgGo_Click(object sender, ImageClickEventArgs e)

 

 

{

 

Session[

 

"QoSDataGrid" + hdnSession.Value] = null;

 

 

LoadQoSData();

 

}

 

 

 

private void LoadQoSData()

 

 

{

 

 

 

DataTable dtQoS;

 

 

 

 

if (Session["QoSDataGrid" + hdnSession.Value] == null)

 

 

{

 

 

 

DateTime _selDate = Convert.ToDateTime(txtSelDate.Text);

 

 

 

 

Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");

 

 

dtQoS = iXTools.iXTrade.Entities.

 

QualityofService.GetQoSAttributesBySourceID(Convert.ToInt32(ddlQoS.SelectedValue), _selDate);

 

 

 

 

 

 

DataColumn isChanged = new DataColumn();

 

 

isChanged.ColumnName =

 

"isChanged";

 

 

isChanged.DataType = System.

 

Type.GetType("System.Boolean");

 

 

isChanged.DefaultValue =

 

"False";

 

 

 

 

DataColumn[] primaryColumn = new DataColumn[1];

 

 

primaryColumn[0] = dtQoS.Columns[

 

"DestinationID"];

 

 

dtQoS.PrimaryKey = primaryColumn;

 

dtQoS.Columns.Add(isChanged);

 

Session[

 

"QoSDataGrid" + hdnSession.Value] = dtQoS;

 

 

}

 

 

 

else

 

 

 

 

 

 

 

dtQoS = (

 

DataTable)Session["QoSDataGrid" + hdnSession.Value];

 

 

grdQoSAttributes.DataSource = dtQoS;

 

 

 

//grdQoSAttributes.DataBind();

 

 

 

 

 

 

 

 

 

Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(HttpContext.Current.Request.UserLanguages[0]);

 

 

}

 

 

 

protected void grdQoSAttributes_ItemDataBound(object source, Telerik.Web.UI.GridItemEventArgs e)

 

 

{

 

 

 

if (e.Item is Telerik.Web.UI.GridDataItem)

 

 

{

 

Telerik.Web.UI.

 

RadComboBox ddlTT = (Telerik.Web.UI.RadComboBox)e.Item.FindControl("ddlTerminating");

 

 

Telerik.Web.UI.

 

RadComboBox ddlCLI = (Telerik.Web.UI.RadComboBox)e.Item.FindControl("ddlCLI");

 

 

Telerik.Web.UI.

 

RadNumericTextBox txtALOC = (Telerik.Web.UI.RadNumericTextBox)e.Item.FindControl("txtALOC");

 

 

Telerik.Web.UI.

 

RadNumericTextBox txtASR = (Telerik.Web.UI.RadNumericTextBox)e.Item.FindControl("txtASR");

 

 

Telerik.Web.UI.

 

RadNumericTextBox txtNER = (Telerik.Web.UI.RadNumericTextBox)e.Item.FindControl("txtNER");

 

 

Telerik.Web.UI.

 

GridDataItem databoundItem = e.Item as Telerik.Web.UI.GridDataItem;

 

 

 

 

if (double.Parse(databoundItem["ALOC"].Text) > 0)

 

 

txtALOC.Text = databoundItem[

 

"ALOC"].Text;

 

 

 

 

if (double.Parse(databoundItem["NER"].Text) > 0)

 

 

txtNER.Text = databoundItem[

 

"NER"].Text;

 

 

 

 

if (int.Parse(databoundItem["ASR"].Text) > 0)

 

 

txtASR.Text = databoundItem[

 

"ASR"].Text;

 

 

 

 

Queue<EntityKVP> quCLI = new Queue<EntityKVP>();

 

 

quCLI.Enqueue(

 

new EntityKVP() { ID = -1, Name = " " });

 

 

quCLI.Enqueue(

 

new EntityKVP() { ID = Convert.ToInt32(CLI.Yes), Name = CLI.Yes.ToString() });

 

 

quCLI.Enqueue(

 

new EntityKVP() { ID = Convert.ToInt32(CLI.No), Name = CLI.No.ToString() });

 

 

ddlCLI.DataSource = quCLI;

 

ddlCLI.DataTextField =

 

"Name";

 

 

ddlCLI.DataValueField =

 

"ID";

 

 

ddlCLI.DataBind();

 

 

 

Queue<EntityKVP> quTerminattingTraffic = new Queue<EntityKVP>();

 

 

quTerminattingTraffic.Enqueue(

 

new EntityKVP() { ID = -1, Name = " " });

 

 

quTerminattingTraffic.Enqueue(

 

new EntityKVP() { ID = Convert.ToInt32(TerminatingTraffic.Direct), Name = TerminatingTraffic.Direct.ToString() });

 

 

quTerminattingTraffic.Enqueue(

 

new EntityKVP() { ID = Convert.ToInt32(TerminatingTraffic.NonDirect), Name = TerminatingTraffic.NonDirect.ToString() });

 

 

ddlTT.DataSource = quTerminattingTraffic;

 

ddlTT.DataTextField =

 

"Name";

 

 

ddlTT.DataValueField =

 

"ID";

 

 

ddlTT.DataBind();

 

 

 

if (databoundItem["CLI"].Text == CLI.Yes.ToString() || databoundItem["CLI"].Text == CLI.No.ToString())

 

 

ddlCLI.SelectedIndex = ddlCLI.FindItemByText(databoundItem[

 

"CLI"].Text).Index;

 

 

 

 

if (databoundItem["TerminatingTraffic"].Text == TerminatingTraffic.Direct.ToString() || databoundItem["TerminatingTraffic"].Text == TerminatingTraffic.NonDirect.ToString())

 

 

ddlTT.SelectedIndex = ddlTT.FindItemByText(databoundItem[

 

"TerminatingTraffic"].Text).Index;

 

 

}

 

}

 

 

 

protected void grdQoSAttributes_SortCommand(object source, Telerik.Web.UI.GridSortCommandEventArgs e)

 

 

{

 

LoadQoSData();

 

}

 

 

 

protected void grdQoSAttributes_PageIndexChanged(object source, Telerik.Web.UI.GridPageChangedEventArgs e)

 

 

{

 

LoadQoSData();

 

}

 

 

 

protected void grdQoSAttributes_ItemUpdated(object source, Telerik.Web.UI.GridUpdatedEventArgs e)

 

 

{

 

}

 

 

 

protected void grdQoSAttributes_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)

 

 

{

 

LoadQoSData();

 

}

 

 

 

protected void RowChanged_ddl(object source, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)

 

 

{

 

 

 

Queue<iXTools.iXTrade.Entities.QualityofService> quQoS;

 

 

Telerik.Web.UI.

 

RadComboBox ddlTT;

 

 

Telerik.Web.UI.

 

RadComboBox ddlCLI;

 

 

Telerik.Web.UI.

 

RadComboBox _sender = (Telerik.Web.UI.RadComboBox)source;

 

 

 

 

if (e.OldValue != e.Value)

 

 

{

 

 

 

if (Session["QoSDataGrid" + hdnSession.Value] != null)

 

 

{

 

quQoS = (

 

Queue<iXTools.iXTrade.Entities.QualityofService>)Session["QoSDataGrid" + hdnSession.Value];

 

 

 

 

foreach (Telerik.Web.UI.GridDataItem item in grdQoSAttributes.Items)

 

 

{

 

ddlTT = (Telerik.Web.UI.

 

RadComboBox)item.FindControl("ddlTerminating");

 

 

ddlCLI = (Telerik.Web.UI.

 

RadComboBox)item.FindControl("ddlCLI");

 

 

 

 

if (ddlTT.ClientID == _sender.ClientID || ddlCLI.ClientID == _sender.ClientID)

 

 

{

 

 

 

foreach (iXTools.iXTrade.Entities.QualityofService obj in quQoS)

 

 

{

 

 

 

if (obj.DestinationID == int.Parse(item["DestinationID"].Text))

 

 

{

 

 

 

if (_sender.ClientID.Contains("Terminating"))

 

 

obj.TerminatingTraffic = e.Text;

 

 

 

else

 

 

 

 

 

 

 

obj.CLI = e.Text;

 

obj.isChanged =

 

true;

 

 

 

 

break;

 

 

}

 

}

 

}

 

}

 

Session[

 

"QoSDataGrid" + hdnSession.Value] = quQoS;

 

 

}

 

}

 

}

 

 

 

protected void imgSave_Click(object source, ImageClickEventArgs e)

 

 

{

 

 

 

if (!Page.IsValid)

 

 

 

 

return;

 

 

 

 

try

 

 

 

 

 

 

 

{

 

 

 

if (Session["QoSDataGrid" + hdnSession.Value] != null)

 

 

{

 

 

 

DataTable dtQoS;

 

 

dtQoS = (

 

DataTable)Session["QoSDataGrid" + hdnSession.Value];

 

 

 

 

DataRow[] dRows = dtQoS.Select("isChanged=true");

 

 

 

 

if (dRows.Length > 0)

 

 

{

 

 

 

StringBuilder strXML = new StringBuilder();

 

 

 

 

strXML.Append(

 

"<QoSAttributes>");

 

 

 

 

 

 

foreach (DataRow row in dRows)

 

 

{

 

strXML.Append(

 

"<QoSAttribute");

 

 

strXML.Append(

 

" DestinationID='" + row["DestinationID"].ToString() + "'");

 

 

strXML.Append(

 

" TerminatingTraffic='" + row["TerminatingTraffic"].ToString() + "'");

 

 

strXML.Append(

 

" CLI='" + row["CLI"].ToString() + "'");

 

 

strXML.Append(

 

" ASR='" + row["ASR"].ToString() + "'");

 

 

strXML.Append(

 

" ALOC='" + row["ALOC"].ToString() + "'");

 

 

strXML.Append(

 

" NER='" + row["NER"].ToString() + "'");

 

 

strXML.Append(

 

" ></QoSAttribute>");

 

 

}

 

strXML.Append(

 

"</QoSAttributes>");

 

 

 

 

if (iXTools.iXTrade.Entities.QualityofService.SetQoSAttributes(strXML.ToString(), int.Parse(ddlQoS.SelectedValue), int.Parse(hdnUserID.Value)))

 

 

Page.ClientScript.RegisterStartupScript(

 

this.GetType(), "inf1", "<script type='text/javascript'>fnShowMessage('Records Saved Successfully.','info');</script>");

 

 

 

 

else

 

 

 

 

 

 

 

 

 

throw new Exception("There is some problem in saving data. Please try again later.");

 

 

}

 

 

 

else

 

 

 

 

 

 

 

 

 

throw new Exception("No Changes to save.");

 

 

}

 

 

 

else

 

 

 

 

 

 

 

{

 

 

 

throw new Exception("Session Expired.");

 

 

}

 

}

 

 

 

catch (Exception ex)

 

 

{

 

Page.ClientScript.RegisterStartupScript(

 

this.GetType(), "Err1", "<script type='text/javascript'>fnShowMessage('" + ex.Message + "','error');</script>");

 

 

}

 

}

 

 

 

protected void RowChanged(object source, System.EventArgs e)

 

 

{

 

Telerik.Web.UI.

 

GridDataItem dgi = null;

 

 

Telerik.Web.UI.

 

RadNumericTextBox ctrl_numeric = new Telerik.Web.UI.RadNumericTextBox();

 

 

Telerik.Web.UI.

 

RadComboBox ctrl_combo = new Telerik.Web.UI.RadComboBox();

 

 

 

 

string ctrl_ID = string.Empty;

 

 

 

 

if (source.GetType().ToString() == "Telerik.Web.UI.RadNumericTextBox")

 

 

{

 

ctrl_numeric = (Telerik.Web.UI.

 

RadNumericTextBox)source;

 

 

dgi = (Telerik.Web.UI.

 

GridDataItem)ctrl_numeric.NamingContainer;

 

 

ctrl_ID = ctrl_numeric.ID;

 

}

 

 

 

else if (source.GetType().ToString() == "Telerik.Web.UI.RadComboBox")

 

 

{

 

ctrl_combo = (Telerik.Web.UI.

 

RadComboBox)source;

 

 

dgi = (Telerik.Web.UI.

 

GridDataItem)ctrl_combo.NamingContainer;

 

 

ctrl_ID = ctrl_combo.ID;

 

}

 

 

 

else

 

 

 

 

 

 

 

 

 

return;

 

 

 

 

int _destinationID = int.Parse((dgi["DestinationID"]).Text);

 

 

 

 

 

 

if (Session["QoSDataGrid" + hdnSession.Value] != null)

 

 

{

 

 

 

DataTable dtQoS = (DataTable)Session["QoSDataGrid" + hdnSession.Value];

 

 

 

 

DataRow row = dtQoS.Rows.Find(_destinationID);

 

 

 

 

switch (ctrl_ID)

 

 

{

 

 

 

case "txtASR":

 

 

row[

 

"ASR"] = ((Telerik.Web.UI.RadNumericTextBox)dgi.FindControl("txtASR")).Text;

 

 

 

 

break;

 

 

 

 

case "txtALOC":

 

 

row[

 

"ALOC"] = ((Telerik.Web.UI.RadNumericTextBox)dgi.FindControl("txtALOC")).Text;

 

 

 

 

break;

 

 

 

 

case "txtNER":

 

 

row[

 

"NER"] = ((Telerik.Web.UI.RadNumericTextBox)dgi.FindControl("txtNER")).Text;

 

 

 

 

break;

 

 

 

 

case "ddlCLI":

 

 

row[

 

"CLI"] = ((Telerik.Web.UI.RadComboBox)dgi.FindControl("ddlCLI")).SelectedItem.Text;

 

 

 

 

break;

 

 

 

 

case "ddlTerminating":

 

 

row[

 

"TerminatingTraffic"] = ((Telerik.Web.UI.RadComboBox)dgi.FindControl("ddlTerminating")).SelectedItem.Text;

 

 

 

 

break;

 

 

}

 

row[

 

"isChanged"] = "true";

 

 

Session[

 

"QoSDataGrid" + hdnSession.Value] = dtQoS;

 

 

}

 

}

 

 

 

protected void imgExport_Click(object sender, ImageClickEventArgs e)

 

 

{

 

grdQoSAttributes.ExportSettings.IgnorePaging =

 

true;

 

 

grdQoSAttributes.ExportSettings.ExportOnlyData =

 

true;

 

 

grdQoSAttributes.ExportSettings.FileName = ddlQoS.Text +

 

"_QualityAttributes_" + hdnUserID.Value;

 

 

grdQoSAttributes.ExportSettings.OpenInNewWindow =

 

true;

 

 

 

 

grdQoSAttributes.MasterTableView.ExportToExcel();

 

}

 

}

0
Daniel
Telerik team
answered on 17 Mar 2011, 05:59 PM
Hello Ravish,

Judging by the problem description I suppose that you have a databinding issue. Unfortunately there is a lot of custom code that makes it very hard to guess the exact problem.
Please download the sample project from the second post and let me know how to modify it so that I can reproduce the issue.

Regards,
Daniel
the Telerik team
0
Ravish
Top achievements
Rank 1
answered on 28 Mar 2011, 02:48 PM
Yes the Object Reference issue is coming in Item Data Bound for binding drop downs. I have two drop down columns in the grid. Can you please suggest how to suppress them. I don't need those columns in excel. In other words can we make column selection while doing export.
0
Daniel
Telerik team
answered on 31 Mar 2011, 09:56 PM
Hello Ravish,

You can try to hide these columns when exporting:
grdQoSAttributes.MasterTableView.GetColumn("ColumnName").Visible = false;
grdQoSAttributes.MasterTableView.GetColumn("ColumnName2").Visible = false;
grdQoSAttributes.MasterTableView.ExportToExcel();

I hope this helps.

Regards,
Daniel
the Telerik team
Tags
Grid
Asked by
Computer Surgeon
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Jason
Top achievements
Rank 1
Ravish
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Daniel
Telerik team
Share this question
or