2 // System.Web.UI.PostBackOptions.cs
5 // Sanjay Gupta (gsanjay@novell.com)
7 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using System.ComponentModel;
34 namespace System.Web.UI
36 public sealed class PostBackOptions
38 private Control control;
39 private string argument;
40 private string actionUrl;
41 private bool autoPostBack;
42 private bool requiresJavaScriptProtocol;
43 private bool trackFocus;
44 private bool clientSubmit;
45 private bool performValidation;
46 private string validationGroup;
48 public PostBackOptions (Control targetControl)
49 : this (targetControl, null, null, false, false, false, true, false, null)
53 public PostBackOptions (Control targetControl, string argument)
54 : this (targetControl, argument, null, false, false, false, true, false, null)
58 public PostBackOptions (Control targetControl, string argument, string actionUrl, bool autoPostBack,
59 bool requiresJavaScriptProtocol, bool trackFocus, bool clientSubmit,
60 bool performValidation, string validationGroup)
62 if (targetControl == null)
63 throw new ArgumentNullException ("targetControl");
64 this.control = targetControl;
65 this.argument = argument;
66 this.actionUrl = actionUrl;
67 this.autoPostBack = autoPostBack;
68 this.requiresJavaScriptProtocol = requiresJavaScriptProtocol;
69 this.trackFocus = trackFocus;
70 this.clientSubmit = clientSubmit;
71 this.performValidation = performValidation;
72 this.validationGroup = validationGroup;
76 public string ActionUrl {
77 get { return actionUrl; }
78 set { actionUrl = value; }
82 public string Argument {
83 get { return argument; }
84 set { argument = value; }
87 [MonoTODO ("Implement support for this in Page")]
88 [DefaultValue (false)]
89 public bool AutoPostBack {
90 get { return autoPostBack; }
91 set { autoPostBack = value; }
95 public bool ClientSubmit {
96 get { return clientSubmit; }
97 set { clientSubmit = value; }
100 [DefaultValue (false)]
101 public bool PerformValidation {
102 get { return performValidation; }
103 set { performValidation = value; }
106 [DefaultValue (true)]
107 public bool RequiresJavaScriptProtocol {
108 get { return requiresJavaScriptProtocol; }
109 set { requiresJavaScriptProtocol = value; }
112 [DefaultValue (null)]
113 public Control TargetControl {
114 get { return control; }
117 [MonoTODO ("Implement support for this in Page")]
118 [DefaultValue (false)]
119 public bool TrackFocus {
120 get { return trackFocus; }
121 set { trackFocus = value; }
124 [MonoTODO ("Implement support for this in Page")]
126 public string ValidationGroup {
127 get { return validationGroup; }
128 set { validationGroup = value; }
131 // Returns true if some of these options must be handled by
133 internal bool RequiresSpecialPostBack {
135 return actionUrl != null ||
136 validationGroup != null ||