Merge pull request #4453 from lambdageek/bug-49721
[mono.git] / mcs / class / System.Web / System.Web.UI.WebControls / SessionParameter.cs
index 521e01662944738087a313cbeefa09f8ff67d771..156754611bf1a881dca6a44d66215e29baa6c9c2 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
 using System.Collections;
 using System.Collections.Specialized;
+using System.Data;
 using System.Text;
+using System.ComponentModel;
 
 namespace System.Web.UI.WebControls {
+
+       [DefaultPropertyAttribute ("SessionField")]
        public class SessionParameter : Parameter {
 
                public SessionParameter () : base ()
@@ -54,20 +57,27 @@ namespace System.Web.UI.WebControls {
                {
                        SessionField = sessionField;
                }
+
+               public SessionParameter (string name, DbType dbType, string sessionField) : base (name, dbType)
+               {
+                       SessionField = sessionField;
+               }
                
                protected override Parameter Clone ()
                {
                        return new SessionParameter (this);
                }
-               
-               protected override object Evaluate (Control control)
+               protected internal
+               override object Evaluate (HttpContext context, Control control)
                {
-                       if (control == null || control.Page == null || control.Page.Session == null)
+                       if (context == null || context.Session == null)
                                return null;
                        
-                       return control.Page.Session [SessionField];
+                       return context.Session [SessionField];
                }
                
+               [DefaultValueAttribute ("")]
+               [WebCategoryAttribute ("Parameter")]
                public string SessionField {
                        get {
                                string s = ViewState ["SessionField"] as string;
@@ -85,5 +95,5 @@ namespace System.Web.UI.WebControls {
                }
        }
 }
-#endif
+