Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi guys,

I can export data to excel from ASP.Net GridView.

but I cann't export data to excel from Asp.net Infragistics WebDataGrid.

my Code is Given below,


private void Excel_Export()
{

Response.Clear();

Response.Buffer = true;

Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.xls");

Response.Charset = "";

Response.ContentType = "application/vnd.ms-excel";

StringWriter sw = new StringWriter();

HtmlTextWriter hw = new HtmlTextWriter(sw);

// GridView1.AllowPaging = false;
//GridView1.DataBind();


wdgrid.DataBind();

for (int i = 0; i < wdgrid.Rows.Count; i++)
{
// Infragistics.Web.UI.
GridRecord row = wdgrid.Rows[i];
row.Attributes.Add("class", "textmode");

}

wdgrid.RenderControl(hw);
// GridView1.RenderControl(hw);
string style = @"<style> .textmode { mso-number-format:\@; } </style>";
Response.Write(style);
Response.Output.Write(sw.ToString());
Response.Flush();
Response.End();

}


it returns below error,

Argument Exception wasunhandled by user code
--------------------------------------------
Script control 'wdgrid' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
Parameter name: scriptControl


How can i solve this?

anybody help me....
Posted

1 solution

May be that feature not supported by the infragestic third party dll. You need to check their support for that.
 
Share this answer
 
Comments
sankmahesh 30-Sep-13 11:12am    
thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900