Click here to Skip to main content
15,906,558 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Using SMTP to send mail Pin
Mike Hankey25-Mar-08 11:46
mveMike Hankey25-Mar-08 11:46 
GeneralRe: Using SMTP to send mail Pin
Vasudevan Deepak Kumar25-Mar-08 19:17
Vasudevan Deepak Kumar25-Mar-08 19:17 
GeneralRe: Using SMTP to send mail Pin
Mike Hankey26-Mar-08 1:53
mveMike Hankey26-Mar-08 1:53 
GeneralQuirky Links and Form Pin
ffowler25-Mar-08 7:53
ffowler25-Mar-08 7:53 
GeneralRe: Quirky Links and Form Pin
pmarfleet25-Mar-08 9:39
pmarfleet25-Mar-08 9:39 
GeneralAuthenticating Web App Using AD Pin
dboy22125-Mar-08 7:40
dboy22125-Mar-08 7:40 
GeneralRe: Authenticating Web App Using AD Pin
Abhijit Jana25-Mar-08 19:05
professionalAbhijit Jana25-Mar-08 19:05 
Questionexporting gridview data into excel, i got this error. Help~ Pin
Dong Kim25-Mar-08 6:16
Dong Kim25-Mar-08 6:16 
I tried to export gridview info to excel. I got this error.

Control 'grdLIST' of type 'GridView' must be placed inside a form tag with runat=server.

This my gridview design.

<asp:GridView ID="grdLIST" runat="server" Visible="False">
</asp:GridView>


I didn't setup fields, because field name is changing due to date term.

This is aspx codeing

protected void cmdEXCEL_Click(object sender, EventArgs e)
{
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();

Response.AddHeader("content-disposition", "attachment;filename=CadilacReport.xls");
Response.Charset = string.Empty;
Response.Cache.SetCacheability(System.Web.HttpCacheability.Public);
Response.ContentType = "application/vnd.xls";

System.IO.StringWriter stringWrite = new System.IO.StringWriter();

HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);

if (grdLIST.HeaderRow != null && grdLIST.HeaderRow.Cells != null)
{
for (int ct = 0; ct < grdLIST.HeaderRow.Cells.Count; ct++)
{
string headerText = grdLIST.HeaderRow.Cells[ct].Text;
if (grdLIST.HeaderRow.Cells[ct].HasControls())
{
if (grdLIST.HeaderRow.Cells[ct].Controls[0].GetType().ToString() == "System.Web.UI.WebControls.DataCountrlLinkButton")
{
headerText = ((LinkButton)grdLIST.HeaderRow.Cells[ct].Controls[0]).Text;
}
grdLIST.HeaderRow.Cells[ct].Controls.Clear();
}
grdLIST.HeaderRow.Cells[ct].Text = headerText;
}
}
if (grdLIST.FooterRow != null)
{
grdLIST.FooterRow.Visible = false;
}
grdLIST.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}

at grdLIST.RenderControl(htmlWrite);, I got that error. How can I solve it? Please help.
GeneralRe: exporting gridview data into excel, i got this error. Help~ Pin
Elizma25-Mar-08 18:12
Elizma25-Mar-08 18:12 
QuestionRe: exporting gridview data into excel, i got this error. Help~ Pin
Dong Kim26-Mar-08 3:57
Dong Kim26-Mar-08 3:57 
QuestionHow to read xml data and make it as HTML table data? Pin
chakran25-Mar-08 4:14
chakran25-Mar-08 4:14 
AnswerRe: How to read xml data and make it as HTML table data? Pin
Mark J. Miller25-Mar-08 7:36
Mark J. Miller25-Mar-08 7:36 
QuestionResponse.WriteFile and Modal window Issue Pin
Saud AKhter25-Mar-08 3:56
Saud AKhter25-Mar-08 3:56 
GeneralCalling webservices asynchronously using java script Pin
Sql Exciter25-Mar-08 3:38
Sql Exciter25-Mar-08 3:38 
GeneralRe: Calling webservices asynchronously using java script Pin
Jesse Squire25-Mar-08 3:59
Jesse Squire25-Mar-08 3:59 
GeneralRe: Calling webservices asynchronously using java script Pin
Declan Bright25-Mar-08 4:01
Declan Bright25-Mar-08 4:01 
GeneralRe: Calling webservices asynchronously using java script Pin
gauthee25-Mar-08 4:01
gauthee25-Mar-08 4:01 
GeneralASP:menu control question Pin
ChrisFarrugia25-Mar-08 3:24
ChrisFarrugia25-Mar-08 3:24 
GeneralRe: ASP:menu control question Pin
gauthee25-Mar-08 4:05
gauthee25-Mar-08 4:05 
GeneralRe: ASP:menu control question Pin
Jesse Squire25-Mar-08 4:08
Jesse Squire25-Mar-08 4:08 
GeneralRe: ASP:menu control question Pin
Declan Bright25-Mar-08 4:16
Declan Bright25-Mar-08 4:16 
GeneralSend Mail Pin
mehrdadc4825-Mar-08 2:59
mehrdadc4825-Mar-08 2:59 
GeneralRe: Send Mail Pin
eyeseetee25-Mar-08 3:07
eyeseetee25-Mar-08 3:07 
QuestionHow to retrieve the value of textbox using session Pin
anpm25-Mar-08 2:18
anpm25-Mar-08 2:18 
GeneralRe: How to retrieve the value of textbox using session Pin
Jesse Squire25-Mar-08 2:38
Jesse Squire25-Mar-08 2:38 

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.