protected void repeatVehicle_ItemCreated(object sender, ListViewItemEventArgs e) { if (e.Item is ListViewDataItem) { ImageUtility imageObj = new ImageUtility(); DataTable items = (DataTable)ViewState["VehicleItems"]; var item = e.Item; HtmlImage image = (HtmlImage)item.FindControl("imgVehiclePicture1"); int index = e.Item.DataItemIndex; DataRow dr = items.Rows[index]; byte[] picture1 = DBUtility.readDBImage(dr,"Picture_1"); if (image != null && picture1 != null) { image.Src = imageObj.byteArrayToBase64String(picture1); } } }
private void bindImages() { if (editVehicle.Picture_1.Length > 0) { imageUtil = new ImageUtility(); imgVehiclePicture1.Src = imageUtil.byteArrayToBase64String(editVehicle.Picture_1); } if (editVehicle.Picture_2.Length > 0) { imageUtil = new ImageUtility(); imgVehiclePicture2.Src = imageUtil.byteArrayToBase64String(editVehicle.Picture_2); } if (editVehicle.Picture_3.Length > 0) { imageUtil = new ImageUtility(); imgVehiclePicture3.Src = imageUtil.byteArrayToBase64String(editVehicle.Picture_3); } }
protected void grdVehicles_RowCreated(object sender, GridViewRowEventArgs e) { if(e.Row.RowType == DataControlRowType.DataRow) { Image image = e.Row.FindControl("vehicleImage") as Image; DataTable vehicleList = Session["SEARCH_VEHICLES"] as DataTable; GridViewRow row = e.Row; int index = e.Row.DataItemIndex; if (image != null) { DataRow dr = vehicleList.Rows[index]; imageUtil = new ImageUtility(); byte[] picture1 = DBUtility.readDBImage(dr,"Picture_1"); if (image != null && picture1 != null) { image.ImageUrl = imageUtil.byteArrayToBase64String(picture1); } } } }