Click to See Complete Forum and Search --> : Export Nested Datagrid To MS Excel


guhananth
10-18-2007, 12:30 AM
Hi,
Outer datagrid is dgMaster and nested one is dgDetails.i had binded the nested grid in item databound of 1st grid

Can u please explain how to export to MS excel.I had written some code as below.but i caqn see the outer grid only but not the nested grid.
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader("content-disposition", "attachment; ")
Response.Charset = ""
Dim Content As String
Dim tw As New System.IO.StringWriter
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
dgMaster.ShowHeader = True

dgMaster.RenderControl(hw)
Dim str As String = "location Abstract Report"
Dim str1 As String

str1 = str + " " + "For" + " " + ddlCity.SelectedItem.Text.Trim()
'End If
ReportHeader.Write(Response, "<br>")
ReportHeader.Write(Response, "<b>" & str1 & "</b>")
ReportHeader.Write(Response, "<br>")
ReportHeader.Write(Response, Content)
Response.Write(tw.ToString())
' End the response.
Response.End()
please help