I’ve downloaded the AMF framework (Application Mobile Framework) to develop easily a mobile application .NET and the jQuery UI mobile.
I have the following html structure:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LandingPage.ascx.cs" Inherits="mobile.LandingPage" %>
<%@ Register TagPrefix="mob" Namespace="Mobile.WebControls" Assembly="AMF" %>
<mob:MobilePage Id="mobilePage" Theme="H" runat="server">
<Header>
<asp:Label runat="server" ID="testLabel"></asp:Label>
</Header>
<Content>
<p>
Welcome in Asp.net Mobile Framework (AMF): The Web Framework for make Web Application. For Smartphones & Tablets.
</p>
</Content>
</mob:MobilePage>
But when I want to set the testLabel in the code-behind file I get a nullReferenceException in C#.
The first part of the code of the class from MobilePage in the AMF.dll looks the following
[ParseChildren(ChildrenAsProperties = true, DefaultProperty = "Items")]
[ToolboxData("<{0}:MobilePage runat=server></{0}:MobilePage>")]
public class MobilePage : Div
{
[Browsable(false)]
public ArrayList Items
{
get;
set;
}
I have also tried to set ParseChildren to false and to remove the DefaultProperty. In the code behind I have also tried the following:
testLabel = new Label() { Text="hello"};
This prevents the nullReferenceException but I didn’t see any text.
Does anyone have a solution/suggestion for this problem?
I am using C#3.5
Thanks in advance!
After a whole day of searching I’ve found that the AMF framework don’t support view state and form controls:
“In AMF, we can have many mobile page in one asp.net page. We don’t use form control () because we can have multiple form in the same asp.net page. So, standard webcontrol don’t work. We don’t use Viewstate too.”
The following code works well in the code behind file:
Thanks for all of your help and suggestions!