Capture Image and Set It to Image Control In GridView using JQuery.
I am working on a webform.It contains a gridview.Each gridview has a linkbutton and image control.If i click on linkbutton,modelpopupextender shows up to capture an image through webcam.
I want to set the captured image to the selected row's image control.
I'm using following JQuery code but it applies to all the image controls in the gridview.
- <script type="text/javascript">
var pageUrl = '<%=ResolveUrl("~/CS.aspx") %>';
$(function () {
jQuery("#webcam").webcam({
width: 320,
height: 240,
mode: "save",
swffile: '<%=ResolveUrl("~/Webcam_Plugin/jscam.swf") %>',
debug: function (type, status) {
$('#camStatus').append(type + ": " + status + '<br /><br />');
},
onSave: function (data) {
$.ajax({
type: "POST",
url: pageUrl + "/GetCapturedImage",
data: '',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (r) {
$("[id*=imgOldEmployee]").css("visibility", "visible");
$("[id*=imgOldEmployee]").attr("src", r.d);
},
failure: function (response) {
alert(response.d);
}
});
},
onCapture: function () {
webcam.save(pageUrl);
}
});
});
</script>