TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


Forums >


ASP.NET Mobile - How to Work with Objects Img with DataBind?


7/15/2008 6:13:00 AM

Hello staff, could resolve the issue and my last at least a matter of links
or data, text, I am now able to work with the ObjectList and DataBind

But now must learn how to work with the ObjectList been a base of data with
objects eg. Img objects and objects of direction for links to another page

How I would do, remember that with the normal object in ASP.NET conventional
DataList we placed within the object that was at the instruction Template

navigateurl='<%# "https://mydominio.com/cybersnet/carteira/?cod... +
DataBinder.Eval(Container.DataItem, "codigo")%>'>

Conforme mostrado no source abaixo do DataList em ASP.NET CONVENCIONAL

<asp:DataList id="Produto" runat="server"
gridlines ="Both"

Font-Size="8pt" CaptionAlign="Top"
OnSelectedIndexChanged="Produto_SelectedIndexChanged" BorderStyle="None"
ShowFooter="False" ShowHeader="False" Width="98%" EnableTheming="False">

<ItemTemplate><table border="0" cellpadding="0" cellspacing="0">
<td rowspan="2" style="width: 80px">
<asp:HyperLink ID="HyperLink1" runat="server"
ImageUrl='<%# "https://mydominio.com/produ... +
DataBinder.Eval(Container.DataItem, "imgpeq")%>'
+".asp?codigo=" + DataBinder.Eval(Container.DataItem, "codigo")%>'

<td style="width: 100px"><b><%#
DataBinder.Eval(Container.DataItem, "produto") %></b><br/><br/><%#
<td style="width: 100px"><%#
"categorias")%><br/><%# RetornaPreço( Container.DataItem ) %>
<td style="width: 84px; text-align: center;"><asp:HyperLink
ID="HyperLink2" runat="server"

NavigateUrl='<%# "https://mydominio.com/carteira/?cod... +
DataBinder.Eval(Container.DataItem, "codigo")%>'

<td style="width: 100px"><asp:HyperLink ID="HyperLink3"
runat="server" ImageUrl="https://mydominio.com/botoes/botao_maisdetalhes...

+".asp?codigo=" + DataBinder.Eval(Container.DataItem, "codigo")%>'


<tr height=1>
<td colspan=4><strong>Catálogo de Produtos:</strong></td>
<tr height=2 bgcolor="#a0522d"><td colspan=4></td></tr>

<tr height=1><td colspan=2></td></tr>
<ItemStyle Font-Names="Verdana" Font-Size="10px" ForeColor="#1883D6" />
<SeparatorStyle BorderStyle="None" />

</table><table border="0" cellpadding="0" cellspacing="0" width="98%">
<td style="width: 6px; height: 19px" align="left">
<asp:HyperLink ID="hpAnterior" runat="server"
<td style="width: 505px; height: 19px; text-align: center;">

<asp:Label ID="labTotal" runat="server" Font-Names="Verdana"
Font-Overline="False" Font-Size="9px" Font-Underline="True"
<asp:Label ID="LabRegistros" runat="server" Font-Bold="True"
Font-Names="Verdana" Font-Size="10px" Font-Strikeout="False"></asp:Label></td>
<td style="width: 23px; height: 19px" align="right">
<asp:HyperLink ID="hpProxima" runat="server"


And the problem solved éra now need to know how to do the same for both the
part of galleries as demonstrated ácima and for the page with details of the
object ObjectList of ASP.NET Mobile as the source code-behind and below


<%@ 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/x... >
<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"
<Field DataField="FirstName" Name="Field1" Title="Nome" />
<Field DataField="LastName" Name="Field2" Title="SobreNome" />




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;
//Erro 'System.Data.DataSet.Tables' é um 'propriedade', mas é usado como
if (IsPostBack == false)


Now need to know because the only data returned in relation to
code were only data from text qdo vai pra page of details

A) show in the gallery or in the fields that paging desire on the
ácima example in the case appears only qdo gallery in the field of data

ID and no data from FirstName and LastName fields (or two columns and not
just a column in the list) and also recognize as a field or object in the
gallery img

Already on the page appears Details of all data of selected select

B) How do I get inside the ObjectList it recognizes a field
link and a field of img

So if someone can help me now thank you

Translated from Portuguese into English by Google