Ir para conteúdo
Fórum Script Brasil
  • 0

Problemas Para exibir a foto no browser C# ASP.NET


ThaaiFeerreira

Pergunta

Boa noite, estou com problema para exibir a foto no browser o repeater traz todas as informações do banco menos a foto. Inseri os dados manualmente no banco.

//TABELA
CREATE TABLE [dbo].[Imoveis](
[CodImovel] [int] IDENTITY(1,1) NOT NULL,
[Descricao] [varchar](750) NOT NULL,
[QtdDorms] [int] NOT NULL,
[TipoImovel] [varchar](7) NOT NULL,
[Localizacao] [varchar](6) NOT NULL,
[Valor] [money] NOT NULL,
[Operacao] [varchar](7) NULL,
[Cidade] [varchar](75) NULL,
[Foto] [varchar](150) NULL
PRIMARY KEY CLUSTERED 
(
[CodImovel] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

//OBJETO DE TRANSFERENCIA
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Entities
{
public class Imovel
{
public int CodImovel { get; set; }
public string Descricao { get; set; }
public int QtdDorms { get; set; }
public string TipoImovel { get; set; }
public string Localizacao { get; set; }
public double Valor { get; set; }
public string Operacao { get; set; }
public string Cidade { get; set; }
public string Foto { get; set; }
}
}

//DAL:
//Conexão com o banco
namespace DAL
{
public class Conexao
{
public static string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["EDGImoveisConnectionString"].ConnectionString;
public static SqlConnection connection = new SqlConnection(connectionString);

public static void Conectar()
{
if (connection.State == System.Data.ConnectionState.Closed)
{
connection.Open();
}
}

public void Desconectar()
{
if (connection.State == System.Data.ConnectionState.Open)
{
connection.Close();
}
}
}
}

namespace DAL
{
public class ImovelDao
{
public List<Imovel> ObterTodasCasas()
{
try
{
var command = new SqlCommand();
command.Connection = Conexao.connection;
command.CommandText = "SELECT * FROM Imoveis";

Conexao.Conectar();

var reader = command.ExecuteReader();
var imoveis = new List<Imovel>();

while (reader.Read())
{
var imovel = new Imovel();

imovel.CodImovel = Convert.ToInt32(reader["CodImovel"]);
imovel.Descricao = reader["Descricao"].ToString();
imovel.QtdDorms = Convert.ToInt32(reader["QtdDorms"]);
imovel.TipoImovel = reader["TipoImovel"].ToString();
imovel.Localizacao = reader["Localizacao"].ToString();
imovel.Valor = Convert.ToDouble(reader["Valor"]);
imovel.Foto = reader["Foto"].ToString();

imoveis.Add(imovel); 
}

return imoveis;
}
catch (Exception)
{
throw;
}
}
}
}

//BLL
namespace BLL
{
public class ImovelBo
{
private ImovelDao _ImovelDao;

public List<Imovel> ObterTodasCasas()
{
_ImovelDao = new ImovelDao();
return _ImovelDao.ObterTodasCasas();
}
}
}

//.CS
namespace EDGOficial.Painel
{
public partial class Imoveis : System.Web.UI.Page
{
private ImovelBo _imovelBo;

protected void Page_Load(object sender, EventArgs e)
{
CarregarImoveisNoRepeater();
}

private void CarregarImoveisNoRepeater()
{
_imovelBo = new ImovelBo();
RepeaterCasas.DataSource = _imovelBo.ObterTodasCasas();
RepeaterCasas.DataBind();
}
}
}

//.ASPX
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div id="paginas">
<asp:Repeater ID="RepeaterCasas" runat="server">
<ItemTemplate>
<div class="capaCasa">
<img src="../Content/ImagensCasas/" <%#DataBinder.Eval(Container.DataItem,"Foto") %> "/>
</div>
<div class="NomeCasa">
<%#DataBinder.Eval(Container.DataItem,"Descricao") %>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
</asp:Content>

Se alguém ai puder ajudar agradeço muito!! :D

13978128_535578699967317_1045774262_o.jpg

Link para o comentário
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152k
    • Posts
      651,7k
×
×
  • Criar Novo...