0
I’m not able to upload the photos in repiter making a carousel coming from the data bank, I can not find anything on the web related to this problem follows the Cod ASPX Imoveldetail
<section class="slider-container">
<ul id="slider" class="slider-wrapper">
<li class="slide-current">
<asp:Repeater ID="RptImg" runat="server">
<ItemTemplate>
<asp:Image ID="Fotos" runat="server" ImageUrl='<%# Container.DataItem %>' />
</ItemTemplate>
</asp:Repeater>
</li>
</ul>
<div class="shadow">
</div>
<ul id="slider-controls" class="slider-controls"></ul>
</section>
CS Imovel detail
private void carregarInformacoes()
{
string[] filesindirectory = Directory.GetFiles(Server.MapPath("~/Imovel/"));
List<ListItem> images= new List<ListItem>();
foreach (string item in filesindirectory)
{
}
RptImg.DataSource = images;
RptImg.DataBind();
int codigoImovel = 0;
int.TryParse(Request.QueryString["IdImovel"], out codigoImovel);
_imovelBo = new ImovelBo();
var imovel = _imovelBo.ObterDetalhe(codigoImovel);
if (imovel != null)
{
lblDescricao.Text = imovel.Obs;
lblOperacao.Text = imovel.DescricaoOperacao;
lblCidade.Text = imovel.DescricaoCidade;
lblLocalizacao.Text = imovel.DescricaoLoc;
lblTipoImovel.Text = imovel.DescricaoTipo;
lblQtDormitorios.Text = imovel.QntQuarto.ToString();
lblValor.Text = imovel.Valor.ToString("#,##0.00");
}
}
where the information and Images are entered in the database
protected void btnSalvarImovel_Click(object sender, EventArgs e)
{
if (fuFotos.HasFile == false)
lblImovel.Text = "Por favor selecione uma foto!";
else
{
List<string> nomeFoto = new List<string> ();
var arquivos = fuFotos.PostedFiles;
foreach (var arquivo in arquivos)
{
string nomeArquivo = arquivo.FileName;
fuFotos.PostedFile.SaveAs(Server.MapPath("~") + "/Imovel/" + nomeArquivo);
nomeFoto.Add(nomeArquivo);
}
string comandoSQL = string.Format("INSERT INTO Imovel Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')",
ddlCidade.SelectedItem.Value, ddlLocalizacao.SelectedItem.Value, ddlOperacao.SelectedItem.Value, ddlTipoImovel.SelectedItem.Value,
txtTitulo.Text, txtObservacao.Text, txtValor.Text, txtQtdQuartos.Text, string.Join(",", nomeFoto));
lblImovel.Text = "Imóvel cadastrado com sucesso!";
try
{
conexaoSQL.Open();
int teste = new SqlCommand(comandoSQL, conexaoSQL).ExecuteNonQuery();
}
finally
{
conexaoSQL.Close();
}
what could be done so that it can call the images in the reapeter?