Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ajax 模組 timer 用法. 安裝 ASPAJAXExtSetup 編輯 ASP.NET 工具用.

Similar presentations


Presentation on theme: "Ajax 模組 timer 用法. 安裝 ASPAJAXExtSetup 編輯 ASP.NET 工具用."— Presentation transcript:

1 Ajax 模組 timer 用法

2 安裝 ASPAJAXExtSetup 編輯 ASP.NET 工具用

3 點選 NEXT 即可

4 安裝完成

5 開啟新網站,建立新的頁面

6 工具箱出現了 AJAX 的工具元件

7 放置一個 SCRIPTMANAGER 放置一個 TIMER 放置一個 PANEL( 一網頁可多個 ) 拖曳兩個 LABEL

8 PANEL 屬性 TRIGGERS 集合 設定行為 TIMER

9 TIMER 屬性 INTERVAL 設定 1000 單位 ( 為一秒 )

10 分別在 TIMER_TICK 與 PAGE_LOAD 輸入 label1.text=now 與 label2.text=now

11 點選網頁按滑鼠右鍵 設定 default.aspx 為起始頁

12

13

14

15 在頁面上放置 PANEL 與 LABEL

16

17 抓取資料庫最新的一筆資料放到各個 LABEL.TEXT

18 判斷各個 LABEL 大於或小於數值,讓 IMAGE.IMAGEURL 產生變化

19 簡單呈現 LABEL 與圖形變化

20 使用 OWC 畫統計圖

21 安裝 OWC11 網頁元件

22

23 加入參考

24

25 Imports owc11

26 'First create a ChartSpace object to hold the chart Dim objCSpace As ChartSpace = New ChartSpaceClass() 'Add a chart and provide a type Dim objChart As ChChart = objCSpace.Charts.Add(0) ' 變更圖形 objChart.Type = ChartChartTypeEnum.chChartTypeArea3D 'add chart titles and legend objChart.HasTitle = True objChart.Title.Caption = "ASP.NET Charts" objChart.HasLegend = True objChart.Legend.Border.DashStyle = OWC11.ChartLineDashStyleEnum.chLineDash objChart.Legend.Position = OWC11.ChartLegendPositionEnum.chLegendPositionRight 'Populate with contrived data ' 數值 Dim strCategory As String = "Cars, Trucks, Vans, Big Rigs, Motorcycles, Mopeds" Dim strValue As String = "13,12,31,43,23,15" 'Add a series to the chart's series collection objChart.SeriesCollection.Add(0) 'load the category and value data objChart.SeriesCollection(0).SetData(ChartDimensionsEnum.chDimCategories, CInt(ChartSpecialDataSourcesEnum.chDataLiteral), strCategory) objChart.SeriesCollection(0).SetData(ChartDimensionsEnum.chDimValues, CInt(ChartSpecialDataSourcesEnum.chDataLiteral), strValue) 'show the chart on the client Response.ContentType = "image/gif" Response.BinaryWrite(DirectCast(objCSpace.GetPicture("gif", 500, 400), Byte())) Response.[End]()

27

28 連接資料 顯示要呈現的兩個欄位

29 Dim strCategory As String = "" Dim strValue As String = "" Dim sum As Integer cn.Open() Dim cm As New SqlDataAdapter("select top 100 * from cc_t", cn) cm.Fill(dbset, "cc") If dbset.Tables("cc").Rows.Count > 15 Then sum = (dbset.Tables("cc").Rows.Count - 1) \ 15 For x As Integer = 0 To dbset.Tables("cc").Rows.Count - 1 Step sum strCategory = strCategory & "," & dbset.Tables("cc").Rows(x).Item("c_t") strValue = strValue & "," & dbset.Tables("cc").Rows(x).Item("cc") Next Else For x As Integer = 0 To dbset.Tables("cc").Rows.Count - 1 strCategory = strCategory & "," & dbset.Tables("cc").Rows(x).Item("c_t") strValue = strValue & "," & dbset.Tables("cc").Rows(x).Item("cc") Next End If sum = (dbset.Tables("cc").Rows.Count - 1) \ 15 For x As Integer = 0 To dbset.Tables("cc").Rows.Count - 1 Step sum strCategory = strCategory & "," & dbset.Tables("cc").Rows(x).Item("c_t") strValue = strValue & "," & dbset.Tables("cc").Rows(x).Item("cc") Next cn.Close()

30

31 建立另一個新網頁 放置一個 BUTTON 與 IMAGE

32 點選 IMAGE 屬性 imageurl 設定建置 OWC 的網頁 例 : xxx.aspx

33 Dim sql1 As String = "select top 100 * from cc_t" cn.Open() Dim cm As New SqlCommand(sql1, cn) Dim reader As SqlDataReader = cm.ExecuteReader If reader.Read Then cn.Close() Session("a") = sql1 'Image1.Visible = True Else 'Image1.Visible = False cn.Close() Response.Write(" alert('sql 指令錯誤 ');<") Response.Write("/script>") End If

34


Download ppt "Ajax 模組 timer 用法. 安裝 ASPAJAXExtSetup 編輯 ASP.NET 工具用."

Similar presentations


Ads by Google