2 // System.Web.UI.PostBackOptions.cs
5 // Sanjay Gupta (gsanjay@novell.com)
7 // Copyright (C) 2004-2010 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.
31 using System.ComponentModel;
33 namespace System.Web.UI
35 public sealed class PostBackOptions
41 bool requiresJavaScriptProtocol;
44 bool performValidation;
45 string validationGroup;
47 public PostBackOptions (Control targetControl)
48 : this (targetControl, null, null, false, false, false, true, false, null)
52 public PostBackOptions (Control targetControl, string argument)
53 : this (targetControl, argument, null, false, false, false, true, false, null)
57 public PostBackOptions (Control targetControl, string argument, string actionUrl, bool autoPostBack,
58 bool requiresJavaScriptProtocol, bool trackFocus, bool clientSubmit,
59 bool performValidation, string validationGroup)
61 if (targetControl == null)
62 throw new ArgumentNullException ("targetControl");
63 this.control = targetControl;
64 this.argument = argument;
65 this.actionUrl = actionUrl;
66 this.autoPostBack = autoPostBack;
67 this.requiresJavaScriptProtocol = requiresJavaScriptProtocol;
68 this.trackFocus = trackFocus;
69 this.clientSubmit = clientSubmit;
70 this.performValidation = performValidation;
71 this.validationGroup = validationGroup;
75 public string ActionUrl {
76 get { return actionUrl; }
77 set { actionUrl = value; }
81 public string Argument {
82 get { return argument; }
83 set { argument = value; }
86 [MonoTODO ("Implement support for this in Page")]
87 [DefaultValue (false)]
88 public bool AutoPostBack {
89 get { return autoPostBack; }
90 set { autoPostBack = value; }
94 public bool ClientSubmit {
95 get { return clientSubmit; }
96 set { clientSubmit = value; }
99 [DefaultValue (false)]
100 public bool PerformValidation {
101 get { return performValidation; }
102 set { performValidation = value; }
105 [DefaultValue (true)]
106 public bool RequiresJavaScriptProtocol {
107 get { return requiresJavaScriptProtocol; }
108 set { requiresJavaScriptProtocol = value; }
111 [DefaultValue (null)]
112 public Control TargetControl {
113 get { return control; }
116 [MonoTODO ("Implement support for this in Page")]
117 [DefaultValue (false)]
118 public bool TrackFocus {
119 get { return trackFocus; }
120 set { trackFocus = value; }
123 [MonoTODO ("Implement support for this in Page")]
125 public string ValidationGroup {
126 get { return validationGroup; }
127 set { validationGroup = value; }
130 // Returns true if some of these options must be handled by
132 internal bool RequiresSpecialPostBack {
134 return actionUrl != null ||
135 validationGroup != null ||