Click here to Skip to main content
16,004,887 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: GridView issue........Anyone...........please? Pin
Christian Graus27-Sep-06 11:37
protectorChristian Graus27-Sep-06 11:37 
GeneralRe: GridView issue........Anyone...........please? Pin
sanju027627-Sep-06 12:58
sanju027627-Sep-06 12:58 
GeneralRe: GridView issue........Anyone...........please? Pin
Christian Graus27-Sep-06 13:08
protectorChristian Graus27-Sep-06 13:08 
Questiondevelopping portal using mspf Pin
WDI27-Sep-06 8:57
WDI27-Sep-06 8:57 
QuestionAJAX postback w/ asp.net Pin
eggie527-Sep-06 8:53
eggie527-Sep-06 8:53 
AnswerRe: AJAX postback w/ asp.net Pin
eggie527-Sep-06 9:10
eggie527-Sep-06 9:10 
QuestionRoboHelp and asp.net 2.0 - SOLVED Pin
#realJSOP27-Sep-06 8:53
professional#realJSOP27-Sep-06 8:53 
Questionexport detailsview to excell Pin
galatia27-Sep-06 8:26
galatia27-Sep-06 8:26 
Hi,
i want some help with exporting detailsview to excell.I m working on a web application and i have a search page and a result page.The result page demonstrates the results of the search in a detailsview and i want to export it to excell.I use a button for that, the code of the button is :

protected void Button1_Click(object sender, EventArgs e)
{
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
Response.Charset = "";

// If you want the option to open the Excel file without saving then
// comment out the line below
//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);
DetailsView1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();

}

public override void VerifyRenderingInServerForm(Control control)
{
/* Confirms that an HtmlForm control is rendered for the specified ASP.NET
server control at run time. */
}

But i have an error message :
"RegisterForEventValidation can only be called during Render();
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.InvalidOperationException: RegisterForEventValidation can only be called during Render();"

Any ideas?????It's very important

Thanks galatia



galatia

AnswerRe: export detailsview to excell Pin
minhpc_bk27-Sep-06 19:49
minhpc_bk27-Sep-06 19:49 
QuestionViewing a single content page in multiple master pages Pin
Jell Ellis27-Sep-06 8:12
Jell Ellis27-Sep-06 8:12 
AnswerRe: Viewing a single content page in multiple master pages Pin
Not Active27-Sep-06 8:30
mentorNot Active27-Sep-06 8:30 
QuestionRe: Viewing a single content page in multiple master pages Pin
Jell Ellis27-Sep-06 10:59
Jell Ellis27-Sep-06 10:59 
AnswerRe: Viewing a single content page in multiple master pages Pin
Guffa27-Sep-06 19:06
Guffa27-Sep-06 19:06 
GeneralRe: Viewing a single content page in multiple master pages Pin
Jell Ellis28-Sep-06 3:38
Jell Ellis28-Sep-06 3:38 
QuestionHELP Pin
Polymorpher27-Sep-06 7:54
Polymorpher27-Sep-06 7:54 
AnswerRe: HELP Pin
Kschuler27-Sep-06 8:25
Kschuler27-Sep-06 8:25 
AnswerRe: HELP Pin
Not Active27-Sep-06 8:27
mentorNot Active27-Sep-06 8:27 
GeneralRe: HELP Pin
Polymorpher27-Sep-06 8:30
Polymorpher27-Sep-06 8:30 
QuestionSample master pages Pin
digsy_27-Sep-06 7:38
digsy_27-Sep-06 7:38 
AnswerRe: Sample master pages Pin
minhpc_bk27-Sep-06 19:48
minhpc_bk27-Sep-06 19:48 
QuestionCustom email class Pin
shapper27-Sep-06 7:21
shapper27-Sep-06 7:21 
AnswerRe: Custom email class Pin
Not Active27-Sep-06 8:16
mentorNot Active27-Sep-06 8:16 
AnswerRe: Custom email class Pin
Kschuler27-Sep-06 11:09
Kschuler27-Sep-06 11:09 
QuestionHow can i fix this OleDbException error? Pin
keroed_edmond27-Sep-06 6:57
keroed_edmond27-Sep-06 6:57 
QuestionSend HTML page by Email. Pin
shapper27-Sep-06 6:13
shapper27-Sep-06 6:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.