I did get past the data connection by using a sqldatadapter. There seems to be a real lack of microsoft mobile information around. I am now working with the objectlist method and getting it setup properly so it shows results from the query. The code and code behind are below:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="DefaultMobile1.aspx.vb" Inherits="_Default" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<mobile:Form ID="frmMainMenu" Runat="server">
<mobile:List ID="lstMainMenu" Runat="server">
<Item Text="By Name" Value="1" />
<Item Text="By Zip" Value="2" />
<Item Text="By Brand" Value="3" />
</mobile:List>
</mobile:Form>
<mobile:Form ID="frmSearchName" Runat="server" Title="Enter a Name">
<mobile:Label ID="lblSearchName" Runat="server">Enter Store Name</mobile:Label>
<mobile:TextBox ID="txtSearchName" Runat="server">
</mobile:TextBox>
<mobile:Command ID="cmdSearchName" Runat="server">Search</mobile:Command>
</mobile:Form>
<mobile:Form ID="frmSearchId" Runat="server" Title="Enter an ID">
<mobile:Label ID="lblSearchId" Runat="server">Enter ZIP</mobile:Label>
<mobile:TextBox ID="txtSearchId" Runat="server">
</mobile:TextBox>
<mobile:Command ID="cmdSearchId" Runat="server">Search</mobile:Command>
</mobile:Form>
<mobile:Form ID="frmSearchCategory" Runat="server" Title="Select a Category">
<mobile:List ID="lstCategories" Runat="server">
</mobile:List>
</mobile:Form>
<mobile:Form ID="frmResult" Runat="server" Title="Search Result">
<mobile:ObjectList ID="lstResult" Runat="server" CommandStyle-StyleReference="subcommand"
LabelStyle-StyleReference="title" AutoGenerateFields="False">
<Field Name="Name" />
</mobile:ObjectList>
</mobile:Form>
</body>
</html>
code behind:
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.MobileControls.MobilePage
Private ds As New DataSet()
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
If Not Page.IsPostBack Then
GetData()
End If
End Sub
Public Sub GetData()
Dim cn As New SqlConnection("sqlconnection1")
Dim Sql As String = "select [StoreName],[StoreStreetAddress],[StoreCity],[StoreState],[StoreZip],[StorePhone],[StoreBrands],[StoreHours],[StoreServiceHours] from New_Store"
Dim da As New SqlDataAdapter(Sql, cn)
da.Fill(ds, "Store")
End Sub
Protected Sub lstMainMenu_ItemCommand(ByVal sender As Object, _
ByVal e As System.Web.UI.MobileControls.ListCommandEventArgs) _
Handles lstMainMenu.ItemCommand
If e.ListItem.Value = 1 Then
Me.ActiveForm = frmSearchName
End If
If e.ListItem.Value = 2 Then
Me.ActiveForm = frmSearchId
End If
If e.ListItem.Value = 3 Then
GetData()
Me.ActiveForm = frmSearchCategory
lstCategories.DataSource = ds.Tables("Store").DefaultView
lstCategories.DataTextField = "StoreName"
lstCategories.DataValueField = "StoreAlias"
lstCategories.DataBind()
End If
End Sub
Public Sub ShowResults()
lstResult.DataSource = ds.Tables("Store").DefaultView
lstResult.LabelField = "StoreName"
lstResult.DataBind()
Me.ActiveForm = frmResult
End Sub
Protected Sub cmdSearchName_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles cmdSearchName.Click
GetData()
ds.Tables("Store").DefaultView.RowFilter = _
String.Format("StoreName like '{0}%'", txtSearchName.Text)
ShowResults()
End Sub
Protected Sub cmdSearchId_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles cmdSearchId.Click
GetData()
ds.Tables("Store").DefaultView.RowFilter = _
String.Format("StoreAlias = {0}", txtSearchId.Text)
ShowResults()
End Sub
Protected Sub lstCategories_ItemCommand(ByVal sender As Object, _
ByVal e As System.Web.UI.MobileControls.ListCommandEventArgs) _
Handles lstCategories.ItemCommand
GetData()
ds.Tables("Store").DefaultView.RowFilter = _
String.Format("StoreAlias = {0}", e.ListItem.Value)
ShowResults()
End Sub
End Class