Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
microsoft.public.dotnet.framework.aspnet.mobile
ASP.NET Mobile - How to Work with Objects Img with DataBind?
LADEF - BRAZIL
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"
RepeatColumns="3"
RepeatDirection="Horizontal"
CellPadding=3
CellSpacing="0"
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">
<tr>
<td rowspan="2" style="width: 80px">
<asp:HyperLink ID="HyperLink1" runat="server"
ImageUrl='<%# "
https://mydominio.com/produ...
+
DataBinder.Eval(Container.DataItem, "imgpeq")%>'
NavigateUrl='<%#
"
https://mydominio.com/publica/detal...
(Request["resolucao"])
+".asp?codigo=" + DataBinder.Eval(Container.DataItem, "codigo")%>'
Target="_top"></asp:HyperLink>
</td>
<td style="width: 100px"><b><%#
DataBinder.Eval(Container.DataItem, "produto") %></b><br/><br/><%#
MercadoPago(Container.DataItem)%>
</td>
</tr>
<tr>
<td style="width: 100px"><%#
RetornaQtde(Container.DataItem)%></br><%#DataBinder.Eval(Container.DataItem,
"categorias")%><br/><%# RetornaPreço( Container.DataItem ) %>
</td>
</tr>
<tr>
<td style="width: 84px; text-align: center;"><asp:HyperLink
ID="HyperLink2" runat="server"
ImageUrl="
https://mydominio.com/botoes/botaoverpedidos...
NavigateUrl='<%# "
https://mydominio.com/carteira/?cod...
+
DataBinder.Eval(Container.DataItem, "codigo")%>'
Target="_top"></asp:HyperLink>
</td>
<td style="width: 100px"><asp:HyperLink ID="HyperLink3"
runat="server" ImageUrl="
https://mydominio.com/botoes/botao_maisdetalhes...
NavigateUrl='<%#
"
https://mydominio.com/publica/detal...
(Request["resolucao"])
+".asp?codigo=" + DataBinder.Eval(Container.DataItem, "codigo")%>'
Target="_top"></asp:HyperLink>
</td>
</tr>
</table>
</ItemTemplate>
<HeaderTemplate>
<tr height=1>
<td colspan=4><strong>Catálogo de Produtos:</strong></td>
<tr height=2 bgcolor="#a0522d"><td colspan=4></td></tr>
</tr>
</HeaderTemplate>
<FooterTemplate>
<tr height=1><td colspan=2></td></tr>
</FooterTemplate>
<ItemStyle Font-Names="Verdana" Font-Size="10px" ForeColor="#1883D6" />
<SeparatorStyle BorderStyle="None" />
</asp:DataList>
</td></tr>
</table><table border="0" cellpadding="0" cellspacing="0" width="98%">
<tr>
<td style="width: 6px; height: 19px" align="left">
<asp:HyperLink ID="hpAnterior" runat="server"
ImageUrl="
https://mydominio.com/botoes/botao_produtosanterior...
Width="77px"></asp:HyperLink></td>
<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"
ForeColor="#1883D6"></asp:Label>
<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"
ImageUrl="
https://mydominio.com/botoes/botao_produtosproxima.gif"></asp:HyperLink>&...
</tr>
</table>
</form>
</body>
</html>
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
SOURCE.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/x...
>
<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="">
<Field DataField="FirstName" Name="Field1" Title="Nome" />
<Field DataField="LastName" Name="Field2" Title="SobreNome" />
</mobile:ObjectList>
</mobile:Form>
</body>
</html>
Code-behind
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
'método'
if (IsPostBack == false)
{
ObjectList1.DataBind();
}
}
}
Now need to know because the only data returned in relation to
code were only data from text qdo vai pra page of details
as:
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
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
ASP.NET Mobile - How to Work with Objects Img with DataBind?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password