婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > Repeater控件數(shù)據(jù)導(dǎo)出Excel(附演示動畫)

Repeater控件數(shù)據(jù)導(dǎo)出Excel(附演示動畫)

熱門標(biāo)簽:蘋果手機(jī)凱立德地圖標(biāo)注 電話機(jī)器人軟件銷售工作 同安公安400電話怎么申請流程 合肥電銷外呼系統(tǒng)哪家公司做的好 申請400電話手續(xù) 百度ai地圖標(biāo)注 南陽外呼系統(tǒng)定制化 預(yù)測式外呼系統(tǒng)使用說明 玉林市機(jī)器人外呼系統(tǒng)哪家好

本演示中,我們實現(xiàn)這個Repeater控件數(shù)據(jù)導(dǎo)出Excel的功能。
我們準(zhǔn)備一個對象

復(fù)制代碼 代碼如下:

Imports Microsoft.VisualBasic
Namespace Insus.NET
Public Class Catalog
Private _ID As Integer
Private _Name As String
Public Property ID As Integer
Get
Return _ID
End Get
Set(value As Integer)
_ID = value
End Set
End Property
Public Property Name As String
Get
Return _Name
End Get
Set(value As String)
_Name = value
End Set
End Property
End Class
End Namespace

準(zhǔn)備數(shù)據(jù)來填充上面創(chuàng)建好的對象
復(fù)制代碼 代碼如下:

Private Function GetData() As List(Of Catalog) Dim cls As New List(Of Catalog) Dim cl As Catalog = New Catalog() cl.ID = 1 cl.Name = "唇膏" cls.Add(cl) cl = New Catalog() cl.ID = 2 cl.Name = "胭脂" cls.Add(cl) cl = New Catalog() cl.ID = 3 cl.Name = "化妝水" cls.Add(cl) cl = New Catalog() cl.ID = 4 cl.Name = "護(hù)手霜" cls.Add(cl) Return cls End Function

在.aspx頁面拉一個Repeater控件
復(fù)制代碼 代碼如下:

asp:Repeater ID="RepeaterCatalog" runat="server">
HeaderTemplate>
table border="1" cellpadding="3" cellspacing="0">
tr>
td>ID
/td>
td>Name
/td>
/tr>
/HeaderTemplate>
ItemTemplate>
tr>
td>
%# Eval("ID")%>
/td>
td>
%# Eval("Name")%>
/td>
/tr>
/ItemTemplate>
FooterTemplate>
/table>
/FooterTemplate>
/asp:Repeater>

然在.aspx.vb為Repeater控件綁定數(shù)據(jù)
復(fù)制代碼 代碼如下:

Imports Insus.NET
Partial Class Default2
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
Data_Binding()
End If
End Sub
Private Sub Data_Binding()
Me.RepeaterCatalog.DataSource = GetData()
Me.RepeaterCatalog.DataBind()
End Sub
End Class

ok,一切準(zhǔn)備緒,我們在.aspx拉一個銨鈕,讓用戶點(diǎn)擊此銨鈕時,能對Repeater控件的數(shù)據(jù)導(dǎo)出Excel。
復(fù)制代碼 代碼如下:

asp:Button ID="Button1" runat="server" Text="Export to Excel" OnClick="Button1_Click" />

銨鈕拉好,我們要去.aspx.vb寫onClick事件,在寫之前,首先下載一個InsusExportToExcel Library 解壓之后放入BIN目錄中。
復(fù)制代碼 代碼如下:

Protected Sub Button1_Click(sender As Object, e As EventArgs)
Dim obj As New InsusExportToExcel() '實例化對象。
obj.ExportToExcel(Me.RepeaterCatalog, "catalog") '傳入Repeater控件以入導(dǎo)出的Excel文件名。
End Sub

當(dāng)然最后,少不了演示

您可能感興趣的文章:
  • asp.net使用Repeater控件中的全選進(jìn)行批量操作實例
  • ASP.NET中repeater控件用法實例
  • 在Repeater控件中通過Eval的方式綁定Style樣式代碼
  • Repeater控件與PagedDataSource結(jié)合實現(xiàn)分頁功能
  • Repeater控件實現(xiàn)編輯、更新、刪除等操作示例代碼
  • 給Repeater控件里添加序號的5種才常見方法介紹
  • Repeater控件綁定的三種方式
  • Repeater控件動態(tài)變更列(Header,Item和Foot)信息實現(xiàn)思路
  • 如何取得Repeater控件選擇的項目及注意事項
  • Repeater控件分別綁定數(shù)組和ArrayList實現(xiàn)思路
  • 淺析Repeater控件的使用 (原樣導(dǎo)出和動態(tài)顯示/隱藏Repeater中的列)

標(biāo)簽:嘉興 揚(yáng)州 南京 臺州 南京 淄博 南昌 海南

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Repeater控件數(shù)據(jù)導(dǎo)出Excel(附演示動畫)》,本文關(guān)鍵詞  Repeater,控件,數(shù)據(jù),導(dǎo)出,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Repeater控件數(shù)據(jù)導(dǎo)出Excel(附演示動畫)》相關(guān)的同類信息!
  • 本頁收集關(guān)于Repeater控件數(shù)據(jù)導(dǎo)出Excel(附演示動畫)的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 雷山县| 千阳县| 雅安市| 宁德市| 巨鹿县| 汶上县| 惠州市| 喀什市| 通河县| 长丰县| 孟村| 尉氏县| 防城港市| 水富县| 临高县| 萝北县| 吉水县| 平阴县| 肃北| 顺昌县| 威海市| 茌平县| 南康市| 通州市| 沙洋县| 襄汾县| 桦南县| 酉阳| 平远县| 荣昌县| 涡阳县| 萝北县| 温宿县| 阿尔山市| 凤庆县| 东乡族自治县| 隆子县| 突泉县| 晋州市| 西充县| 阿巴嘎旗|