周協吶侃尖殻會。壓侃尖殻會嶄?泌惚贋壓 危列訳周?夸乎旗鷹?幣 AlertDiv <div> 圷殆。
協吶 ToggleAlertDiv 痕方?乎痕方辛咨茄賜?幣 AlertDiv 圷殆?旺氏功象危列訳周厚 個匈中議冲弼。
協吶 ClearErrorState 痕方?乎痕方辛咨茄危列?連 UI。
隠贋厚個?隼朔梓 Ctrl+F5 壓箝誓匂嶄臥心匈中。
?耽倖猟云崇嶄耶紗匯倖寄噐巣議方?隼朔汽似“柴麻”梓泥參處幣撹孔議指窟。
繍及屈倖猟云崇議峙厚個葎 0?隼朔汽似“柴麻”梓泥參處幣危列訳周。
繍氏?幣徭協吶 AlertDiv 圷殆?遇音頁箝誓匂?連崇。和夕處幣阻匯倖危列訳周議幣箭 。
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Try
Dim a As Int32
a = Int32.Parse(TextBox1.Text)
Dim b As Int32
b = Int32.Parse(TextBox2.Text)
Dim res As Int32 = a / b
Label1.Text = res.ToString()
Catch ex As Exception
If (TextBox1.Text.Length > 0 AndAlso TextBox2.Text.Length > 0) Then
ex.Data("ExtraInfo") = " You can''t divide " & _
TextBox1.Text & " by " & TextBox2.Text & "."
End If
Throw ex
End Try
End Sub
Protected Sub ScriptManager1_AsyncPostBackError(ByVal sender As Object, ByVal e As System.Web.UI.AsyncPostBackErrorEventArgs)
If (e.Exception.Data("ExtraInfo") <> Nothing) Then
ScriptManager1.AsyncPostBackErrorMessage = _
e.Exception.Message & _
e.Exception.Data("ExtraInfo").ToString()
Else
ScriptManager1.AsyncPostBackErrorMessage = _
"An unspecified error occurred."
End If
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>UpdatePanel Error Handling Example</title>
<style type="text/css">
#UpdatePanel1 {
width: 200px; height: 50px;
border: solid 1px gray;
}
#AlertDiv{
left: 40%; top: 40%;
position: absolute; width: 200px;
padding: 12px;
border: #000000 1px solid;
background-color: white;
text-align: left;
visibility: hidden;
z-index: 99;
}
#AlertButtons{
position: absolute; right: 5%; bottom: 5%;
}
</style>
</head>
<body id="bodytag">
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat=&
|