2
Friends
After following the example I made the adjustment in the code, I am not able to send the information to Actionresult
@model ProjetoDelphiMobile.Models.cliente
@{
ViewBag.Title = "";
}
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script>
function BuscarCaminho()
{
var srcRecebe = document.getElementById("selecao").innerText;
alert(srcRecebe);
if (srcRecebe > 0) {
$.post("/ConsultaCliente/AtualizaFoto", { caminhofoto: srcRecebe }).done(function (data) {
alert(data)
window.location.reload();
})
}
}
</script>
<form>
<fieldset data-role="controlgroup">
<label>Foto:</label>
<div id="selecao" onchange="BuscarCaminho()" >
@Html.DropDownList("idFoto", String.Empty)
</div>
<div >
@* <div >
<img id="foto" src="@Url.Action("AtualizaFoto", "ConsultaCliente", new {caminhofoto = "caminho" })" alt="thumbnail" />
</div>*@
<br />
<label>Nome:</label>
@Html.TextBoxFor(model => model.nome, new { disabled = false })
<label>Nome:</label>
@Html.TextBoxFor(model => model.nome, new { disabled = false })
<label>Nome do pai:</label>
@Html.TextBoxFor(model => model.pai, new { disabled = false })
<label>Nome da Mãe:</label>
@Html.TextBoxFor(model => model.mae, new { disabled = false })
<label>Data de Nascimento:</label>
@Html.TextBoxFor(model => model.datanascimento, new { disabled = false })
<ul data-role="listview" data-inset="true" data-divider-theme="e">
<li><a href="/ConsultaCliente">Retornar para consulta</a></li>
</ul>
</fieldset>
</form>
In my Views:
public ActionResult AtualizaFoto(string caminhofoto)
{
int largura = 100;
int altura = 100;
WebImage webImagem = new WebImage(@caminhofoto).Resize(largura, altura, false, false);
return File(webImagem.GetBytes(), @caminhofoto);
}
Isn’t it easier to use jQuery to do this? You put the tag on the question but you’re not using it. Why?
– Leonel Sanches da Silva
@Ciganomorrisonmendez, I put the tag because I’m using Jquery, now if you say it’s easier then show me how you would solve this situation?
– Harry
Quiet. In which field is the road information?
– Leonel Sanches da Silva
Viewbag.idFoto = new Selectlist(dao.fotos, "idFoto", "Photo");
– Harry