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

Discussion in 'ASP .Net Mobile' started by LADEF - BRASIL, Aug 29, 2008.

  1. 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
     
    LADEF - BRASIL, Aug 29, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lord0
    Replies:
    1
    Views:
    581
    Thomas Weidenfeller
    Apr 19, 2006
  2. chiara
    Replies:
    6
    Views:
    490
    Barry Schwarz
    Oct 6, 2005
  3. Replies:
    7
    Views:
    458
    Adam Nielsen
    Sep 28, 2007
  4. Habib Safarov
    Replies:
    0
    Views:
    720
    Habib Safarov
    Oct 6, 2006
  5. b301
    Replies:
    0
    Views:
    1,218
Loading...

Share This Page