1
using System;
2
using System.Data;
3
using System.Configuration;
4
using System.Web;
5
using System.Web.Security;
6
using System.Web.UI;
7
namespace WebHelper
8
{
9
/// <summary>
10
/// 在Ajax的UpdatePanel中弹出窗口
11
/// </summary>
12
public class AjaxHelper
13
{
14
/// <summary>
15
/// 在Ajax的UpdatePanel中弹出alert窗口
16
/// </summary>
17
/// <param name="control">要注册的启用脚本的控件</param>
18
/// <param name="Message">要在alert窗口中显示的信息</param>
19
public static void showAlert(Control control, string message)
20
{
21
string strMessage = "alert('" + message + "')";
22
23
ScriptManager.RegisterStartupScript(control,
24
control.GetType(), null, strMessage, true);
25
}
26
/// <summary>
27
/// 在Ajax的UpdatePanel中弹出alert窗口
28
/// </summary>
29
/// <param name="control">要注册的启用脚本的控件</param>
30
/// <param name="key">要注册的启用脚本的键</param>
31
/// <param name="message">要在alert窗口中显示的信息</param>
32
public static void showAlert(Control control, string key, string message)
33
{
34
string strMessage = "alert('" + message + "')";
35
ScriptManager.RegisterStartupScript(control,
36
control.GetType(), key, strMessage, true);
37
}
38
/// <summary>
39
/// 在Ajax的UpdatePanel中弹出showModelessDialog窗口
40
/// </summary>
41
/// <param name="control">要注册的启用脚本的控件</param>
42
/// <param name="sURL">必选参数,类型:字符串。用来指定对话框要显示的文档的URL</param>
43
/// <param name="vArguments">可选参数,类型:变体。用来向对话框传递参数。传递的参数类型不限,包括数组等。对话框通过window.dialogArguments来取得传递进来的参数</param>
44
/// <param name="sFeatures">可选参数,类型:字符串。用来描述对话框的外观等信息,可以使用以下的一个或几个,用分号";"隔开。
45
///dialogHeight 对话框高度,不小于100px,IE4中dialogHeight 和 dialogWidth 默认的单位是em,而IE5中是px,为方便其见,在定义modal方式的对话框时,用px做单位。
46
///dialogWidth: 对话框宽度。
47
///dialogLeft: 距离桌面左的距离。
48
///dialogTop: 离桌面上的距离。
49
///center: {yes | no | 1 | 0 }:窗口是否居中,默认yes,但仍可以指定高度和宽度。
50
///help: {yes | no | 1 | 0 }:是否显示帮助按钮,默认yes。
51
///resizable: {yes | no | 1 | 0 } [IE5+]:是否可被改变大小。默认no。
52
///status: {yes | no | 1 | 0 } [IE5+]:是否显示状态栏。默认为yes[ Modeless]或no[Modal]。
53
///scroll:{ yes | no | 1 | 0 | on | off }:指明对话框是否显示滚动条。默认为yes。
54
/// </param>
55
public static void showModelessDialog(Control control, string sURL, string vArguments, string sFeatures)
56
{
57
string strMessage = "showModelessDialog('" + sURL + "','"+vArguments+"','"+sFeatures+"')";
58
ScriptManager.RegisterStartupScript(control,
59
control.GetType(), null, strMessage, true);
60
}
61
/// <summary>
62
/// 在Ajax的UpdatePanel中弹出showModelessDialog窗口
63
/// </summary>
64
/// <param name="control">要注册的启用脚本的控件</param>
65
/// <param name="key">要注册的启用脚本的键</param>
66
/// <param name="sURL">必选参数,类型:字符串。用来指定对话框要显示的文档的URL</param>
67
/// <param name="vArguments">可选参数,类型:变体。用来向对话框传递参数。传递的参数类型不限,包括数组等。对话框通过window.dialogArguments来取得传递进来的参数</param>
68
/// <param name="sFeatures">可选参数,类型:字符串。用来描述对话框的外观等信息,可以使用以下的一个或几个,用分号";"隔开。
69
///dialogHeight 对话框高度,不小于100px,IE4中dialogHeight 和 dialogWidth 默认的单位是em,而IE5中是px,为方便其见,在定义modal方式的对话框时,用px做单位。
70
///dialogWidth: 对话框宽度。
71
///dialogLeft: 距离桌面左的距离。
72
///dialogTop: 离桌面上的距离。
73
///center: {yes | no | 1 | 0 }:窗口是否居中,默认yes,但仍可以指定高度和宽度。
74
///help: {yes | no | 1 | 0 }:是否显示帮助按钮,默认yes。
75
///resizable: {yes | no | 1 | 0 } [IE5+]:是否可被改变大小。默认no。
76
///status: {yes | no | 1 | 0 } [IE5+]:是否显示状态栏。默认为yes[ Modeless]或no[Modal]。
77
///scroll:{ yes | no | 1 | 0 | on | off }:指明对话框是否显示滚动条。默认为yes。
78
///</param>
79
public static void showModelessDialog(Control control, string key, string sURL, string vArguments, string sFeatures)
80
{
81
string strMessage = "showModelessDialog('" + sURL + "','" + vArguments + "','" + sFeatures + "')";
82
ScriptManager.RegisterStartupScript(control,
83
control.GetType(), key, strMessage, true);
84
}
85
/// <summary>
86
/// 在Ajax的UpdatePanel中弹出showModalDialog窗口
87
/// </summary>
88
/// <param name="control">要注册的启用脚本的控件</param>
89
/// <param name="sURL">必选参数,类型:字符串。用来指定对话框要显示的文档的URL</param>
90
/// <param name="vArguments">可选参数,类型:变体。用来向对话框传递参数。传递的参数类型不限,包括数组等。对话框通过window.dialogArguments来取得传递进来的参数</param>
91
/// <param name="sFeatures">可选参数,类型:字符串。用来描述对话框的外观等信息,可以使用以下的一个或几个,用分号";"隔开。
92
///dialogHeight 对话框高度,不小于100px,IE4中dialogHeight 和 dialogWidth 默认的单位是em,而IE5中是px,为方便其见,在定义modal方式的对话框时,用px做单位。
93
///dialogWidth: 对话框宽度。
94
///dialogLeft: 距离桌面左的距离。
95
///dialogTop: 离桌面上的距离。
96
///center: {yes | no | 1 | 0 }:窗口是否居中,默认yes,但仍可以指定高度和宽度。
97
///help: {yes | no | 1 | 0 }:是否显示帮助按钮,默认yes。
98
///resizable: {yes | no | 1 | 0 } [IE5+]:是否可被改变大小。默认no。
99
///status: {yes | no | 1 | 0 } [IE5+]:是否显示状态栏。默认为yes[ Modeless]或no[Modal]。
100
///scroll:{ yes | no | 1 | 0 | on | off }:指明对话框是否显示滚动条。默认为yes。
101
/// </param>
102
public static void showModalDialog(Control control, string sURL, string vArguments, string sFeatures)
103
{
104
string strMessage = "showModalDialog('" + sURL + "','" + vArguments + "','" + sFeatures + "')";
105
ScriptManager.RegisterStartupScript(control,
106
control.GetType(), null, strMessage, true);
107
}
108
/// <summary>
109
/// 在Ajax的UpdatePanel中弹出showModalDialog窗口
110
/// </summary>
111
/// <param name="control">要注册的启用脚本的控件</param>
112
/// <param name="key">要注册的启用脚本的键</param>
113
/// <param name="sURL">必选参数,类型:字符串。用来指定对话框要显示的文档的URL</param>
114
/// <param name="vArguments">可选参数,类型:变体。用来向对话框传递参数。传递的参数类型不限,包括数组等。对话框通过window.dialogArguments来取得传递进来的参数 </param>
115
/// <param name="sFeatures">可选参数,类型:字符串。用来描述对话框的外观等信息,可以使用以下的一个或几个,用分号";"隔开。
116
///dialogHeight 对话框高度,不小于100px,IE4中dialogHeight 和 dialogWidth 默认的单位是em,而IE5中是px,为方便其见,在定义modal方式的对话框时,用px做单位。
117
///dialogWidth: 对话框宽度。
118
///dialogLeft: 距离桌面左的距离。
119
///dialogTop: 离桌面上的距离。
120
///center: {yes | no | 1 | 0 }:窗口是否居中,默认yes,但仍可以指定高度和宽度。
121
///help: {yes | no | 1 | 0 }:是否显示帮助按钮,默认yes。
122
///resizable: {yes | no | 1 | 0 } [IE5+]:是否可被改变大小。默认no。
123
///status: {yes | no | 1 | 0 } [IE5+]:是否显示状态栏。默认为yes[ Modeless]或no[Modal]。
124
///scroll:{ yes | no | 1 | 0 | on | off }:指明对话框是否显示滚动条。默认为yes。
125
///</param>
126
public static void showModalDialog(Control control, string key, string sURL, string vArguments, string sFeatures)
127
{
128
string strMessage = "showModalDialog('" + sURL + "','" + vArguments + "','" + sFeatures + "')";
129
ScriptManager.RegisterStartupScript(control,
130
control.GetType(), key, strMessage, true);
131
}
132
}
133
}
134
135
136

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136
