TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Senorita
NA
123
8.7k
export excel file using gridview in asp.net using vb.net
Nov 22 2018 7:34 AM
Hi i am creating excle file inside the for loop :- using below code
GridView1.DataBind()
GridView1.DataSource = dt1
GridView1.DataBind()
Dim path As String = Server.MapPath("~/" & (ConfigurationSettings.AppSettings("DocketAnnexure")))
If Not Directory.Exists(path) Then
Directory.CreateDirectory(path)
End If
If File.Exists(path & "/Invoice_Annexure_details" & awbno + "_" + Convert.ToString(count) & ".xls") Then
File.Delete(path & "/Invoice_Annexure_details" & awbno + "_" + Convert.ToString(count) & ".xls")
End If
Using sw As New StringWriter()
Using hw As New HtmlTextWriter(sw)
Dim writer As StreamWriter = File.CreateText(path & "/Invoice_Annexure_details" & awbno + "_" + Convert.ToString(count) & ".xls")
Try
GridView1.RenderControl(hw)
writer.WriteLine(sw.ToString())
writer.Flush()
writer.Close()
''hw.Flush()
''hw.Close()
''hw.Dispose()
writer.Dispose()
sw.Flush()
sw.Close()
sw.Dispose()
GC.Collect()
Catch ex As Exception
writer.Flush()
writer.Close()
'hw.Flush()
'hw.Close()
'hw.Dispose()
writer.Dispose()
sw.Flush()
sw.Close()
sw.Dispose()
GC.Collect()
End Try
End Using
End Using
my first file as been created with data but when i create next file its blank creat
Reply
Answers (
1
)
how to create the navigation bar in asp.net mvc
I am trying to populate Amount text field auto