340 likes | 503 Views
Ajax 模組 timer 用法. 安裝 ASPAJAXExtSetup 編輯 ASP.NET 工具用. 點選 NEXT 即可. 安裝完成. 開啟新網站,建立新的頁面. 工具箱出現了 AJAX 的工具元件. 放置一個 SCRIPTMANAGER 放置一個 TIMER 放置一個 PANEL( 一網頁可多個 ) 拖曳兩個 LABEL. PANEL 屬性 TRIGGERS 集合 設定行為 TIMER. TIMER 屬性 INTERVAL 設定 1000 單位 ( 為一秒 ). 分別在 TIMER_TICK 與 PAGE_LOAD
E N D
安裝ASPAJAXExtSetup 編輯ASP.NET工具用
放置一個SCRIPTMANAGER 放置一個TIMER 放置一個PANEL(一網頁可多個) 拖曳兩個LABEL
PANEL屬性TRIGGERS集合 設定行為TIMER
TIMER屬性INTERVAL 設定1000單位(為一秒)
分別在TIMER_TICK與PAGE_LOAD 輸入label1.text=now 與 label2.text=now
點選網頁按滑鼠右鍵 設定default.aspx為起始頁
<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>
判斷各個LABEL大於或小於數值,讓IMAGE.IMAGEURL產生變化判斷各個LABEL大於或小於數值,讓IMAGE.IMAGEURL產生變化
'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]()
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()
建立另一個新網頁 放置一個BUTTON與IMAGE
點選IMAGE 屬性imageurl 設定建置OWC的網頁 例: xxx.aspx
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