Subscribe

RSS Feed (xml)

Navigation in a Mobile Web Form

The ASPX page is as follows:


<mobile:Form id="Form1" runat="server">


<mobile:Label id="Label1" runat="server">This is Form1</mobile:Label>


<mobile:Link id="Link1" runat="server"


NavigateUrl="#Form2">Go To Form2</mobile:Link>


<mobile:Link id="Link2" runat="server"


NavigateUrl="#Form3">Go To Form3</mobile:Link>


</mobile:Form>


<mobile:Form id="Form2" runat="server">


<mobile:Label id="Label2" runat="server">This is Form2</mobile:Label>


<mobile:Link id="Link3" runat="server"


NavigateUrl="#Form1">Go To Form1</mobile:Link>


<mobile:Link id="Link4" runat="server"


NavigateUrl="#Form3">Go To Form3</mobile:Link>


</mobile:Form>


<mobile:Form id="Form3" runat="server">


<mobile:Label id="Label3" runat="server">This is Form3</mobile:Label>


<mobile:Command id="Command1" onclick="Command1_Click"


runat="server">Go To Form1</mobile:Command>


<mobile:Command id="Command2" onclick="Command2_Click"


runat="server">Go To Form2</mobile:Command>


</mobile:Form>


In


<script runat="server" /> block or codebehind:


void Command1_Click(Object sender, EventArgs e) {


ActiveForm = Form1;


}


void Command2_Click(Object sender, EventArgs e) {


ActiveForm = Form2;


}


Comments


Mobile ASP.NET Web Forms, unlike ASP.NET Web Forms, can have multiple form elements.


By default, the first form on a mobile page becomes the active form.The


<mobile:Link> control allows you to navigate from one form to another within a page.


The target of the link is set by the NavigateUrl property and takes the form of


#FormID, where FormID is the ID of the form that you want to navigate to.


You can also programmatically make a form active by using the ActiveForm property


as shown in Form3.

No comments:

Archives

Variety in the Web World