Mobile Page Unit of Mobile Site

Description

A lot of gap as I was busy last week and the best happening is the last weekend. One of my experiences I wanted to share was Installing IE 6.0. I installed IE 6.0 thought it supports XML and lot more big thoughts like this but the best part happening is every time I try to connect to msdnlibrary or try to open some aspx specific URL it throws error and the browser closes asking for sending the Report to the creators. Anyway tough time is over as now as I went back to IE 5.5. I don't know this was happening with me only or there are more victims of curiosity.

So here is we came to Mobile Page unit. What it is ? Ok This is something like creating WAP Pages it is still as usual my basic starting So here i will be storing only some info but What it exactly is the same as if people heard of WAPPages and many sites offer you to create your own WAP Pages similar to WebPages but limit it to the device size and strength.

I am looking for good chances to do all that here also and able to extend every unit.Let me know if somewhere those chances are growing.

Here we will use SQL Server as usual something new something different.

This unit is divided in two parts

  • Mobile Page Entry  :The user will create and save the Page
  • Mobile Page View   :The user can view his Page after providing his Page Name

 In this article we will see first Part where user create  Mobile Page.Save the same also in MobileSite directory.

Check out the Code

Source Code:

// Source Code starts
<%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" Language="C#"Debug="true" %>
<%@ Register TagPrefix="mobile"
Namespace="System.Web.UI.MobileControls"
Assembly="System.Web.Mobile" %>
<%@ Import
Namespace="System" %>
<%@ Import
Namespace="System.Data"%>
<%@ Import
Namespace="System.Data.SqlClient" %>
<script runat="server" language="C#">
public string strAccessConn ="server=localhost;uid=sa;pwd=;database=practice";
public void Page_Save(Object sender, EventArgs e)
{
if(Page.IsValid)
{
SqlConnection myConn =
new SqlConnection(strAccessConn);
SqlCommand myCommand =
new SqlCommand("Insert into Page_Unit
Page_Name,Page_Data) values
'"+pagename.Text+"','"+pagecontent.Text+"')",myConn);
myConn.Open();
myCommand.ExecuteNonQuery();
ActiveForm =Form2;
}
}
</script>
<mobile:Form id = "Form1" runat="server">
<
mobile:Label runat="server" ID="Label1">Page Name</mobile:Label>
<
mobile:TextBox runat="server" id="pagename"/>
<
mobile:Label runat="server" ID="Label2">Page Content</mobile:Label>
<
mobile:TextBox runat="server" id="pagecontent"/>
<
mobile:Command runat="server" OnClick="Page_Save" Text="Go!"
ID="Command1"/>
</
mobile:Form>
<
mobile:Form runat="server" id="Form2"><mobile:Label id ="status" runat="server">
Your Page is successfully created
</mobile:Label>
<
mobile:Link runat="server" NavigateURL="MobilePageview.aspx" ID="Link1">
View your Page
</mobile:Link>
</
mobile:Form>

// Source Code End

MobilePageUnitSH1.gif

MobilePageUnitSH2.gif

MobilePageUnitSH3.gif

              


Similar Articles