2003-09-04 Sebastien Pouliot <spouliot@videotron.ca>
[mono.git] / mcs / class / System.Web.Mobile / System.Web.UI.MobileControls / Link.cs
1 /**
2  * Project   : Mono
3  * Namespace : System.Web.UI.MobileControls
4  * Class     : Link
5  * Author    : Gaurav Vaish
6  *
7  * Copyright : 2003 with Gaurav Vaish, and with
8  *             Ximian Inc
9  */
10
11 using System;
12 using System.Collections;
13 using System.Web.UI;
14 using System.Web.Mobile;
15
16 namespace System.Web.UI.MobileControls
17 {
18         public class Link : MobileControl, IPostBackEventHandler
19         {
20                 public Link()
21                 {
22                 }
23
24                 void IPostBackEventHandler.RaisePostBackEvent(string argument)
25                 {
26                         MobilePage.ActiveForm = MobilePage.GetForm(argument);
27                 }
28
29                 public override void AddLinkedForms(IList linkedForms)
30                 {
31                         string url = NavigateUrl;
32                         string pref = Constants.FormIDPrefix;
33                         if(url.StartsWith(pref))
34                         {
35                                 url = url.Substring(pref.Length);
36                                 Form toAdd = ResolveFormReference(url);
37                                 if(toAdd != null && !toAdd.HasActiveHandler())
38                                         linkedForms.Add(toAdd);
39                         }
40                 }
41
42                 public string NavigateUrl
43                 {
44                         get
45                         {
46                                 object o = ViewState["NavigateUrl"];
47                                 if(o != null)
48                                         return (string)o;
49                                 return String.Empty;
50                         }
51                         set
52                         {
53                                 ViewState["NavigateUrl"] = value;
54                         }
55                 }
56
57                 public string SoftkeyLabel
58                 {
59                         get
60                         {
61                                 object o = ViewState["SoftkeyLabel"];
62                                 if(o != null)
63                                         return (string)o;
64                                 return String.Empty;
65                         }
66                         set
67                         {
68                                 ViewState["SoftkeyLabel"] = value;
69                         }
70                 }
71         }
72 }