Hello,
How to show processing image when a page is loaded or postback in Vb of asp net
I had create the Chart Applications in Vb.Net, I would like to Show processing image when a page is loaded or postback when the user press generate Chart Button.
Here my Coding of Generate Chart:
Protected Sub btn_Rate_Click(sender As Object, e As EventArgs) Handles btn_Rate.Click
If String.IsNullOrEmpty(Label45.Text) Then
Dim message As String = "Select Period End "
Dim sb As New System.Text.StringBuilder()
sb.Append("<script type = 'text/javascript'>")
sb.Append("window.onload=function(){")
sb.Append("alert('")
sb.Append(message)
sb.Append("')};")
sb.Append("</script>")
ClientScript.RegisterClientScriptBlock(Me.GetType(), "alert", sb.ToString())
DropDownList5.BackColor = Color.Red
DropDownList5.ForeColor = Color.Yellow
DropDownList6.BackColor = Color.Red
DropDownList6.ForeColor = Color.Yellow
DropDownList9.BackColor = Color.Red
DropDownList9.ForeColor = Color.Yellow
DropDownList10.BackColor = Color.Red
DropDownList10.ForeColor = Color.Yellow
DropDownList12.BackColor = Color.Red
DropDownList12.ForeColor = Color.Yellow
DropDownList16.BackColor = Color.Red
DropDownList16.ForeColor = Color.Yellow
DropDownList17.BackColor = Color.Red
DropDownList17.ForeColor = Color.Yellow
Else
If DropDownList2.SelectedIndex <= 0 And DropDownList13.SelectedIndex <= 0 Then
btn_Int.Visible = False
DropDownList2.BackColor = Color.Red
DropDownList2.ForeColor = Color.Yellow
Dim message As String = "Please Select Department"
Dim sb As New System.Text.StringBuilder()
sb.Append("<script type = 'text/javascript'>")
sb.Append("window.onload=function(){")
sb.Append("alert('")
sb.Append(message)
sb.Append("')};")
sb.Append("</script>")
ClientScript.RegisterClientScriptBlock(Me.GetType(), "alert", sb.ToString())
Else
DropDownList2.BackColor = Color.White
DropDownList2.ForeColor = Color.Black
btn_Int.Visible = True
If String.IsNullOrEmpty(Label22.Text) Then
Label39.Text = Label40.Text
Else
System.Threading.Thread.Sleep(5000)
Label39.Text = Label40.Text & Label41.Text
Label37.Visible = True
Label48.Visible = True
Label49.Visible = False
Label52.Text = String.Empty
Label54.Text = String.Empty
Label37.Text = Label38.Text & " Rate " & " in " & Label39.Text
BindRateChart()
btn_Print.Visible = True
RateChart.Visible = True
If RadioButtonList1.SelectedIndex = 3 Then
Label37.Text = "12-Month Rolling Trend of " & Label38.Text & " Rate " & " in " & Label39.Text
Label48.Text = ""
Else
Label37.Text = Label38.Text & " Rate " & " in " & Label39.Text
Label48.Text = "From" & " " & Label42.Text & " " & "to" & " " & Label45.Text
End If
End If
End If
End If
End Sub
Private Sub BindIntChart()
Label58.Text = "Number of " & Label59.Text
RateChart.Visible = True
Dim dtInt As System.Data.DataTable = New System.Data.DataTable("dtInts")
For Each cell As TableCell In gvInt.HeaderRow.Cells
dtInt.Columns.Add(cell.Text.Trim())
Next
For Each row As GridViewRow In gvInt.Rows
dtInt.Rows.Add()
Dim k As Integer = 0
For k = 0 To row.Cells.Count - 1
dtInt.Rows(row.RowIndex)(k) = row.Cells(k).Text.Trim()
Next
Next
Dim departments As List(Of String) = New List(Of String)()
departments = (From p In dtInt.AsEnumerable()
Select p.Field(Of String)("Department")).Distinct().ToList()
If RateChart.Series.Count() = 1 Then
RateChart.Series.Remove(RateChart.Series(0))
End If
Dim i As Integer = 0
For i = 0 To departments.Count - 1 Step 1
Dim x As String() = (From p In dtInt.AsEnumerable()
Order By p.Field(Of String)("Period_Shown")
Select p.Field(Of String)("Period_Shown")).Distinct().ToArray()
Dim y As List(Of Decimal) = New List(Of Decimal)()
Dim j As Integer = 0
For j = 0 To x.Length - 1 Step 1
Dim numInt As Decimal = (From p In dtInt.AsEnumerable()
Where p.Field(Of String)("Department") = departments(i) _
AndAlso p.Field(Of String)("Period_Shown") = x(j)
Order By p.Field(Of String)("Period_Shown")
Select Convert.ToDecimal(p.Field(Of String)("Num_Int"))).FirstOrDefault()
y.Add(numInt)
Next
RateChart.Series.Add(New System.Web.UI.DataVisualization.Charting.Series(departments(i)))
RateChart.Series(departments(i)).IsValueShownAsLabel = False
RateChart.Series(departments(i)).BorderWidth = 3
RateChart.Series(departments(i)).ChartType = SeriesChartType.Line
RateChart.Series(departments(i)).Points.DataBindXY(x, y)
RateChart.Series(departments(i)).MarkerStyle = MarkerStyle.Cross
RateChart.Series(departments(i)).MarkerSize = 6
RateChart.Series(departments(i)).MarkerColor = Color.Gray
Next
RateChart.Legends.Add("Default")
RateChart.Legends(0).Docking = Docking.Bottom
RateChart.Legends(0).IsTextAutoFit = True
RateChart.Legends(0).Alignment = System.Drawing.StringAlignment.Center
RateChart.Legends(0).Enabled = True
RateChart.ChartAreas(0).AxisX.Interval = 1
RateChart.ChartAreas(0).AxisX.Title = "Period"
RateChart.ChartAreas(0).AxisX.TitleFont = New System.Drawing.Font("Times New Roman", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0)
RateChart.ChartAreas(0).AxisX.TitleForeColor = System.Drawing.Color.Red
RateChart.ChartAreas(0).AxisX.MajorGrid.LineDashStyle = DataVisualization.Charting.ChartDashStyle.Dot
RateChart.ChartAreas(0).AxisX.MajorGrid.LineColor = System.Drawing.Color.DimGray
RateChart.ChartAreas(0).AxisX.MinorGrid.LineDashStyle = DataVisualization.Charting.ChartDashStyle.Dot
RateChart.ChartAreas(0).AxisX.MinorGrid.LineColor = System.Drawing.Color.DimGray
RateChart.ChartAreas(0).AxisY.Title = Label58.Text
RateChart.ChartAreas(0).AxisY.TitleFont = New System.Drawing.Font("Times New Roman", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0)
RateChart.ChartAreas(0).AxisY.TitleForeColor = System.Drawing.Color.Red
RateChart.ChartAreas(0).AxisY.TitleAlignment = System.Drawing.StringAlignment.Far
RateChart.ChartAreas(0).AxisY.TextOrientation = TextOrientation.Rotated270
RateChart.ChartAreas(0).AxisY.MajorGrid.LineDashStyle = DataVisualization.Charting.ChartDashStyle.Dot
RateChart.ChartAreas(0).AxisY.MajorGrid.LineColor = System.Drawing.Color.DimGray
RateChart.ChartAreas(0).AxisY.MinorGrid.LineDashStyle = DataVisualization.Charting.ChartDashStyle.Dot
RateChart.ChartAreas(0).AxisY.MinorGrid.LineColor = System.Drawing.Color.White
btn_Download_RD.Visible = False
btn_Download_RD0.Visible = True
End Sub