對我怎麼能格式/結構/模板GridView中的任何幫助,使從Excel電子表格的細胞中的內容將 顯示爲:GridView控件模板
<li>"looking to display data from column1 here between the li tags"</li>
<p>"and data from column2 here between the p tags"</p>
<!-- and so row two from excel/objDataset1 would do the same -->
<li>"data from column1 here"</li>
<p>"data from column2 here"</p>
etc...
這裏是我用來獲取一個名爲碼Excel的範圍內文件到一個GridView:
Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & Server.MapPath("Spreadsheet.xls") _
& ";" & "Extended Properties=Excel 8.0;"
' original code was: & "Data Source=" & Server.MapPath("../ExcelData.xls") _ ' ???
Dim objConn As New OleDbConnection(sConnectionString)
objConn.Open()
' Create new OleDbCommand to return the data from the worksheet/RangeName.
Dim objCmdSelect As New OleDbCommand("SELECT * FROM RangeName", objConn)
Dim objAdapter1 As New OleDbDataAdapter()
objAdapter1.SelectCommand = objCmdSelect
Dim objDataset1 As New DataSet()
' Fill the DataSet with the information from the worksheet/RangeName.
objAdapter1.Fill(objDataset1, "XLData") ' ?!?!?
' Build
GridView1.DataSource = objDataset1.Tables(0).DefaultView
GridView1.DataBind()
objConn.Close()
----------------------------位後,我--------------------------------------
<!-- It doesn't do much a present but it does display the info -->
<asp:GridView ID="GridView1" runat="server" style="height: 182px"
BackColor="Transparent"
BorderColor="#DEDFDE"
BorderStyle="None"
BorderWidth="1px"
CellPadding="4"
ForeColor="Black"
GridLines="None">
<RowStyle BackColor="Transparent"
/>
<FooterStyle BackColor="#CCCC99" />
<%-- <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />--%>
<%-- I do not want to show the column header info from the excel file - which is coming through - also --%>
<AlternatingRowStyle BackColor="Transparent" />
</asp:GridView>
我甚至不知道我是否應該使用GridView控件或別的東西 - 所以保持很好,如果你可以簡單的...
它是什麼,現在這樣做,你不希望它做什麼?或者你還想做什麼? – Rap 2009-12-12 16:44:41