i have developed a web application from someone, in which there is an option "Export to Excel" and he guides me in the manual to assign inter-user rights to the Microsoft Excel Application (DCOM comopnent) from dcomcnfg.exe found within "control panel >
Admistrative tools > Components services > DCOM Configs". I have assigned the the permission to local users but still i unable to acces that particular functionality...........
i use the technique of playing with the content types............. but i am not aware of that technique
kindly help me in configuring it as well as giving me the background info of the process.... you can be technical with me
Instead of DataGrid1, I am using GridView1 in aspx form . But it is giving the error " Control GridView1 of type GridView must be placed inside the form tag with runat = server".
Hi Ratnakar thanks for giving a short solution, but i don't know what is wrong with my aproach..i will list down my approach.. --> i have a web page with only one grid view and one button --> in button click event i have added same code what u have given,
only in place of datagrid.RenderControl(htmlWrite), i am using gridview1.RenderControl(htmlWrite); as i am having gridview with id gridview1. --> after clicking of button, i am getting this error, can you please help me out...
error is Server Error in '/rrsclient' Application. -------------------------------------------------------------------------------- Invalid postback or callback argument. Event validation is enabled using in configuration or in a page. For security purposes,
this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback
or callback data for validation. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentException:
Invalid postback or callback argument. Event validation is enabled using in configuration or in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.
If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. Source Error: An unhandled exception was generated during the execution of the current web request.
Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [ArgumentException: Invalid postback or callback argument. Event validation is enabled using in configuration or in a page.
For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in
order to register the postback or callback data for validation.] System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +356 System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +108 System.Web.UI.WebControls.TextBox.LoadPostData(String
postDataKey, NameValueCollection postCollection) +22 System.Web.UI.WebControls.TextBox.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +11 System.Web.UI.Page.ProcessPostData(NameValueCollection postData,
Boolean fBeforeLoad) +381 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2965
The value "23429110140706" in datagrid column, is being displayed as "2.34291E+13 " in the excel sheet. I want to retain "23429110140706" in excel sheet as well. Can someone please help me with this??
so, does anybody has an idia how to avoid error posted above:
Instead of DataGrid1, I am using GridView1 in aspx form . But it is giving the error " Control GridView1 of type GridView must be placed inside the form tag with runat = server".
If you use this code with a site the has an SSL certificate in IE, it wont work. You will be prompted with a msgbox 'Internet Explorer was not able to open this Internet Site. The requested site is either unavailable or cannot be found. Please try again
later'
Azfar Khan
Member
12 Points
6 Posts
Re: How To: Make "Export to Excel" always open excel in a separate Window
May 10, 2007 11:47 AM|LINK
i have developed a web application from someone, in which there is an option "Export to Excel" and he guides me in the manual to assign inter-user rights to the Microsoft Excel Application (DCOM comopnent) from dcomcnfg.exe found within "control panel > Admistrative tools > Components services > DCOM Configs". I have assigned the the permission to local users but still i unable to acces that particular functionality...........
i use the technique of playing with the content types............. but i am not aware of that technique
kindly help me in configuring it as well as giving me the background info of the process.... you can be technical with me
Thanks & Regards
Azfar Khan
curiousneo
0 Points
3 Posts
Re: How To: Make "Export to Excel" always open excel in a separate Window
May 11, 2007 08:25 AM|LINK
Instead of DataGrid1, I am using GridView1 in aspx form . But it is giving the error " Control GridView1 of type GridView must be placed inside the form tag with runat = server".
Thanks
Joey_Crack
Member
212 Points
112 Posts
Re: How To: Make "Export to Excel" always open excel in a separate Window
May 14, 2007 05:35 AM|LINK
akhilesh@slk
Member
2 Points
5 Posts
Re: How To: Make "Export to Excel" always open excel in a separate Window
May 24, 2007 02:29 PM|LINK
Hi Ratnakar thanks for giving a short solution, but i don't know what is wrong with my aproach..i will list down my approach.. --> i have a web page with only one grid view and one button --> in button click event i have added same code what u have given, only in place of datagrid.RenderControl(htmlWrite), i am using gridview1.RenderControl(htmlWrite); as i am having gridview with id gridview1. --> after clicking of button, i am getting this error, can you please help me out... error is Server Error in '/rrsclient' Application. -------------------------------------------------------------------------------- Invalid postback or callback argument. Event validation is enabled using in configuration or in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentException: Invalid postback or callback argument. Event validation is enabled using in configuration or in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [ArgumentException: Invalid postback or callback argument. Event validation is enabled using in configuration or in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.] System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +356 System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +108 System.Web.UI.WebControls.TextBox.LoadPostData(String postDataKey, NameValueCollection postCollection) +22 System.Web.UI.WebControls.TextBox.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +11 System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +381 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2965
dotnetguts
Member
206 Points
95 Posts
Re: How To: Make "Export to Excel" always open excel in a separate Window
Jun 01, 2007 08:01 PM|LINK
Follow the below link this will help you out in solving your problem
http://dotnetguts.blogspot.com/2006/10/export-datagrid-data-to-excel-aspnet_15.html
http://dotnetguts.blogspot.com/2006/10/import-excel-to-datagrid-aspnet.html
DotNetGuts (DNG)
http://dotnetguts.blogspot.com
Asp.Net 1.1 asp.net 2.0 asp.net Daily Free Code
http://dotnetguts.blogspot.com
Logon to Sharepoint Forums
prash_dark
Member
12 Points
15 Posts
Re: How To: Make "Export to Excel" always open excel in a separate Window
Jul 02, 2007 09:41 AM|LINK
The value "23429110140706" in datagrid column, is being displayed as "2.34291E+13 " in the excel sheet. I want to retain "23429110140706" in excel sheet as well. Can someone please help me with this??
Prash..
jaishankar27...
Member
58 Points
249 Posts
Re: How To: Make "Export to Excel" always open excel in a separate Window
Jul 09, 2007 09:55 AM|LINK
Hi ALL.. Try this, its working.....
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=EmployeeProjectReport.xls");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);pnldetail.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
Jai
VadimZ
Member
4 Points
11 Posts
Re: How To: Make "Export to Excel" always open excel in a separate Window
Jul 17, 2007 05:22 PM|LINK
Hi,
so, does anybody has an idia how to avoid error posted above:
Instead of DataGrid1, I am using GridView1 in aspx form . But it is giving the error " Control GridView1 of type GridView must be placed inside the form tag with runat = server".
thanks
VadimZ
Member
4 Points
11 Posts
Re: How To: Make "Export to Excel" always open excel in a separate Window
Jul 17, 2007 06:48 PM|LINK
if you did not found solution try this:
HtmlForm hf = new HtmlForm();hf.Controls.Add(gridView);
it works for me.
fwank
Member
2 Points
1 Post
Re: How To: Make "Export to Excel" always open excel in a separate Window
Aug 24, 2007 01:11 PM|LINK
I tried this and it does'nt work. Any other idea?