I set the value of a image control via the following jquery code:
$('.image').click(function () {
var imgPath = $(this).attr('src');
var imgName = imgPath.substring(0, imgPath.length - 4);
var imgAlt = $(this).attr('alt');
$('#<%= detailedImage.ClientID %>').
attr('src', imgName + '-large.jpg').
attr('alt', imgAlt);
The picture shows up perfectly in the browser. However I cannot access it’s src attribute:
string imgName = detailedImage.Src;
imgName is always an empty string. Any suggestions?
Changing the
srcof animg, even though theimgis placed within a<form>doesn’t submit thesrcto the server. You need to set the newsrcin something that will be submitted in the form, i.e. a hidden field. Try this:If you now have something like this in your markup:
You should be able to retrieve
ImageSource.Valueserver-side.