Login    
 
 
 
 
Text/HTML
  
You are here :: Blogs Saturday, May 19, 2012

Search
Note: This uses the internal blog search engine. The Google search engine is also available at the top of the page.
  
Disclaimer

Please review the site disclaimer before downloading or using content found on this site

  
Categories
  
DEVSHED Blog
As always, I welcome your comments!
Jan 19

Written by: Steve Gray
1/19/2010 6:03 PM  RssIcon

Instructions on how to get Excel to open a web page.

<body>
    <form id="form1" runat="server">
        <asp:Label id="lblTable" runat="server"></asp:Label>
    </form>
</body>

 

Code behind:

Protected Sub Page_Load(ByVal sender As Object,  _
    ByVal e As System.EventArgs) Handles Me.Load
Response.ContentType = "application/vnd.ms-excel"
Dim sb As New StringBuilder
sb.Append("<table>")
sb.Append("<tr>")
sb.Append("<td style='font-weight:bold'>Order</td>")
sb.Append("<td style='font-weight:bold'>Doc Date</td>")
sb.Append("<td style='font-weight:bold'>Customer PO</td>")
sb.Append("<td style='font-weight:bold'>Lot</td>")
sb.Append("<td style='font-weight:bold;width:400px'>Subdiv</td>")
sb.Append("</tr>")
Using oDR As SqlDataReader = ...your code to populate a datareader
    While oDR.Read
        sb.Append("<tr>")
        sb.Append("<td>" & oDR("sopnumbe") & "</td>")
        sb.Append("<td>" & oDR("docdate") & "</td>")
        sb.Append("<td>" & oDR("cstponbr") & "</td>")
        sb.Append("<td>" & oDR("address3") & "</td>")
        sb.Append("<td>" & oDR("vchrsubdivisionname") & "</td>")
        sb.Append("</tr>")
 
    End While
End Using
sb.Append("</table>")
Me.lblTable.Text = sb.ToString
End Sub

Tags:
Categories:
As always, I welcome your comments!
  
 
 
Home | Products | Blogs | Contact Us | Links | God's Plan
Privacy Statement | Terms Of Use
 
Copyright 2011 by Devshed.us