-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: _Neeraj_
Message 3 in Discussion

Try this method by passing your datagris and the response object to the method, 

public void DgToXls(DataGrid dg , HttpResponse response)
{
        response.Clear();
        response.Charset = "";
        response.ContentType = "application/vnd.ms-excel";

        StringWriter stringWrite = new StringWriter();
        HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);

        if(dg.AllowPaging) dg.AllowPaging = false;                              
        dg.GridLines = GridLines.Both;
        dg.HeaderStyle.Font.Bold = true;
        
        dg.RenderControl(htmlWrite);            
                        
        htmlWrite.RenderBeginTag(HtmlTextWriterTag.P);
        htmlWrite.RenderEndTag();
                        
        response.Write(stringWrite.ToString());
        response.End();
}

Regards, 
Neeraj Saluja


----- Original Message -----
From: BlazingPavang <[EMAIL PROTECTED]>
Date: Fri, 6 Aug 2004 01:36:18 -0700
Subject: unable to populate DataGrid Contents in Excel Sheet
To: BDOTNET <[EMAIL PROTECTED]>


New Message on BDOTNET


unable to populate DataGrid Contents in Excel Sheet


Reply

 Reply to Sender   Recommend Message 1 in Discussion 

From: BlazingPavang 


hi,
    i'm retrieving data in grid based on the start date & end date in
the textboxes.I'm able to retrieve data in a grid,but
on click of button i'm opening a new page where i'm using  


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

Response.Charset = "";

to download to excel.then i'm not getting the contents in the grid.

what might be the problem.

Thanking you.

with regards,

pavan.G
 
View other groups in this category. 



Also on MSN:
Start Chatting | Listen to Music | House & Home | Try Online Dating |
Daily Horoscopes



To stop getting this e-mail, or change how often it arrives, go to
your E-mail Settings.

Need help? If you've forgotten your password, please go to Passport
Member Services.
For other questions or feedback, go to our Contact Us page. 

If you do not want to receive future e-mail from this MSN group, or if
you received this message by mistake, please click the "Remove" link
below. On the pre-addressed e-mail message that opens, simply click
"Send". Your e-mail address will be deleted from this group's mailing
list.
Remove my e-mail address from BDOTNET.


-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to