GETTING A GIVEN AS A FIELD BD TEMPLATE IN THE OBJECTLIST OF VS2005

L

LADEF - BRASIL

Hello staff, I have a table of a base ACCESS, with the following fields

ID - Automatic Numbering <campo chave>
FirstName - Text
LastName - Text
Phone - Text

What I would like to know is how to recover a figure of the field ID and a
string of FirstName field, the code-behind in CSharp Asp.NetMobile to embed
the tag <ItemTemplate> </ ItemTemplate> as shown in the code. Aspx of Mob
ileWebForm below, as it tried several times and gives error

MobileWebForm .aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
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="Form1" runat="server" Paginate="True">
<mobile:ObjectList ID="ObjectList1" Runat="server"
CommandStyle-StyleReference="subcommand" BackCommandText="Return To List"
ItemsPerPage="5" AutoGenerateFields="False" LabelStyle-Alignment="Left"
StyleReference="" LabelStyle-StyleReference="title">
<DeviceSpecific>
<Choice
Xmlns="http://schemas.microsoft.com/mobile/html32template">
<ItemTemplate>
<asp:image id="Image2" runat="server"></asp:image> - <asp:HyperLink
ID="HyperLink1"
runat="server" NavigateUrl=’ <%#
“Detalhes.aspx?codigo=â€+DataBinder.Eval(((ObjectList)Container.NamingContainer).Selection.Value,("ID"))%>’><%#
DataBinder.Eval(((ObjectList)Container.NamingContainer).Selection.Value,("FirstName"))%>
</asp:HyperLink><br><Field DataField="FirstName" Name="Field1" Title="Name" />
<br>
</br>
</ItemTemplate>
</Choice>
</DeviceSpecific>
<Field DataField="LastName" Name="Field2" Title="LastName" />


</mobile:ObjectList>
<mobile:Image ID="Image1" Runat="server">
</mobile:Image>

</mobile:Form>
</body>
</html>

Code-behind this page

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.Mobile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.MobileControls;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;

public partial class _Default : System.Web.UI.MobileControls.MobilePage
{
protected void Page_Load(object sender, EventArgs e)
{

OleDbConnection DBConn;
OleDbDataAdapter DBCommand;
DataSet DSPageData = new DataSet();
DBConn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" +
"DATA SOURCE=" + Server.MapPath("EmployeeDatabase.mdb;"));
DBCommand = new OleDbDataAdapter("Select * " + "From Employee "
+ "Order By FirstName", DBConn);
DBCommand.Fill(DSPageData, "Emps");
ObjectList1.DataSource = DSPageData.Tables["Emps"].DefaultView;
// Error 'System.Data.DataSet.Tables' is a' property ', but is used as'
method'

if (IsPostBack == false)
{
ObjectList1.DataBind();

}

}
}

If someone can help me now I thank

Translated from Portuguese into English by Google
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top