1 / 34

Ajax 模組 timer 用法

Ajax 模組 timer 用法. 安裝 ASPAJAXExtSetup 編輯 ASP.NET 工具用. 點選 NEXT 即可. 安裝完成. 開啟新網站,建立新的頁面. 工具箱出現了 AJAX 的工具元件. 放置一個 SCRIPTMANAGER 放置一個 TIMER 放置一個 PANEL( 一網頁可多個 ) 拖曳兩個 LABEL. PANEL 屬性 TRIGGERS 集合 設定行為 TIMER. TIMER 屬性 INTERVAL 設定 1000 單位 ( 為一秒 ). 分別在 TIMER_TICK 與 PAGE_LOAD

adam-carson
Download Presentation

Ajax 模組 timer 用法

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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. <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </controls> <httpHandlers> <remove verb="*" path="*.asmx"/> <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/> </httpHandlers> <httpModules> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </httpModules>

  13. 在頁面上放置PANEL與LABEL

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

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

  16. 簡單呈現LABEL與圖形變化

  17. 使用OWC畫統計圖

  18. 安裝OWC11 網頁元件

  19. 加入參考

  20. Imports owc11

  21. '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]()

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

  23. 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()

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

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

  26. 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("<script>alert('sql指令錯誤');<") Response.Write("/script>") End If

More Related