Saturday, October 18, 2014

export to excel in vb.net

Posted by Gnani Palepu  |  No comments


 if you want more related search please click here  
 please help to other  
 http://scriptquery.blogspot.in/  

 Export Excel  
 ------------:-  
 step:1  
 ------  
  <telerik:RadButton ID="btnExportExl" runat="server" text="Export To Excel"></telerik:RadButton>  
 step:2  
 -------  
 if incase the control is in update panel we need write below the content template  
 <Triggers >  
     <asp:PostBackTrigger ControlID ="btnExportExl" />  
 </Triggers>  
 step3:  
 ------  
 Protected Sub btnExportExl_Click(sender As Object, e As System.EventArgs) Handles btnExportExl.Click  
     Try  
       If Session("Alerts").Rows.Count <> 0 Then  
         Dim export = New ExcelRequest()  
         'export.FromDate = Utility.GetProperDate(fromDt.SelectedDate)  
         'export.ToDate = Utility.GetProperDate(toDt.SelectedDate)  
         export.ItemList = Session("Alerts")  
         export.Type = 1  
         export.ReportsName = "Alerts"  
         export.FileName = "Alerts"  
         export.FooterType = True  
         export.FooterName = "Softvent"  
         ExportToExcel(export)  
       End If  
     Catch ex As Exception  
     End Try  
   End Sub  
 Public Shared Sub ExportToExcel(request As ExcelRequest)  
     Dim resObj = New Excel()  
     resObj.ExportToExcel(request)  
 End Sub  
 step4:-  
 ---------  
 where ever the grid is binding or call the datatable  
 we need write below the table  
  Session("Alerts") = dt  

 if you want more related search please click here  
 please help to other  
 http://scriptquery.blogspot.in/  


11:53 PM Share:

0 comments:

Get updates in your email box
Complete the form below, and we'll send you the best coupons.

Deliver via FeedBurner
Proudly Powered by Blogger.
back to top