Answers

Question and Answer:

  Home  .Net Mobile

⟩ Explain .NET Mobile Events?

.NET mobile controls expose events which are device independent. They have an object model with programmable properties, methods and events.

Eg:

<%@ Page Inherits="System.Web.UI.MobileControls.MobilePage"%>

<%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>

<script runat="server">

string age;

private void AgeClick(Object sender, EventArgs e)

{

age=text1.Text;

ActiveForm=Form2;

}

private void Form2_Activate(Object sender, EventArgs e)

{

message.Text="You are " + age + " years old";

}

</script>

<Mobile:Form id="form1" runat="server">

<Mobile:Label runat="server">Age?</Mobile:Label>

<Mobile:TextBox runat="server" id="text1" />

<Mobile:Command runat="server" OnClick="AgeClick" Text="Submit" />

</Mobile:Form>

<Mobile:Form id="form2" runat="server" OnActivate="Form2_Activate">

<Mobile:Label runat="server" id="message" />

</Mobile:Form>

 157 views

More Questions for you: