protected void gvCategory1_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "DeleteRec") { int Id = Convert.ToInt32(e.CommandArgument.ToString()); List <CustomerLocationPic> pics = (List <CustomerLocationPic>)ViewState[SessionKey.Key.PagedataTable.ToString()]; pics.Remove(pics.FirstOrDefault(id => id.RowSerialNo == Id)); ViewState[SessionKey.Key.PagedataTable.ToString()] = pics; hidCount.Value = ""; hidCount.Value = pics.Count.ToString(); if (hidCount.Value == "0") { imglocation.Visible = false; imglocation.ImageUrl = ""; Image.Visible = false; } gvCategory1.DataSource = pics; gvCategory1.DataBind(); } if (e.CommandName == "ShowRec") { int Id = Convert.ToInt32(e.CommandArgument.ToString()); List <CustomerLocationPic> pics = (List <CustomerLocationPic>)ViewState[SessionKey.Key.PagedataTable.ToString()]; CustomerLocationPic pics1 = pics.FirstOrDefault(id => id.RowSerialNo == Id);//.Single<CustomerLocationPic>(); string strImage = pics1.LocationPicture; imglocation.ImageUrl = strImage; } }
protected void gvCategory_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { CustomerLocationPic dr = (CustomerLocationPic)e.Row.DataItem; string strImage = dr.LocationPicture; //((Image)(e.Row.FindControl("imglocation"))).ImageUrl = "~/CustomerDocs/LocationPics/" + strImage; } }
protected void gvCategory1_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item) { CustomerLocationPic dr = (CustomerLocationPic)e.Item.DataItem; string strImage = dr.LocationPicture; imglocation.ImageUrl = strImage; //((Image)(e.Row.FindControl("imglocation"))).ImageUrl = "~/CustomerDocs/LocationPics/" + strImage; } }
private void fillestimate(int CustomerId, int ProductId, int ProductTypeId) { try { List <CustomerLocationPic> customerLocationPicList = new List <CustomerLocationPic>(); DataSet ds = new DataSet(); ds = shuttersBLL.Instance.FetchShutterDetails(CustomerId, ProductId, ProductTypeId); ViewState[QueryStringKey.Key.ProductId.ToString()] = ProductId; btnsave.Text = "Update"; btndelete.Visible = true; if (ds.Tables[0] != null) { if (ds.Tables[0].Rows.Count > 0) { txtCustomer.Text = ds.Tables[0].Rows[0]["CustomerName"].ToString(); ddlshuttername.SelectedValue = ds.Tables[0].Rows[0]["ShutterId"].ToString(); bindshutter_subfields(); ddlShutterTop.SelectedValue = ds.Tables[0].Rows[0]["ShutterTopId"].ToString(); txtWork_area.Text = ds.Tables[0].Rows[0]["WorkArea"].ToString(); ddlColor.SelectedValue = ds.Tables[0].Rows[0]["ShutterColorId"].ToString(); ddlSurface_mount.SelectedValue = ds.Tables[0].Rows[0]["SurfaceMountId"].ToString(); txtHeight.Text = ds.Tables[0].Rows[0]["ShutterLength"].ToString(); ddlWidth.SelectedValue = ds.Tables[0].Rows[0]["ShutterWidthId"].ToString(); txtQuantity.Text = ds.Tables[0].Rows[0]["Quantity"].ToString(); txtSpcl_inst.Text = ds.Tables[0].Rows[0]["SpecialInstruction"].ToString(); //LocImg = ds.Tables[0].Rows[0]["LocationPicture"].ToString().Split(','); //imgplc_Loc.ImageUrl = LocImg[0].ToString(); } } if (ds.Tables[1] != null) { int count = ds.Tables[1].Rows.Count; hdncount.Value = "1"; if (count > 0) { hdncount.Value = count.ToString(); ddlaccessories.SelectedValue = ds.Tables[1].Rows[0]["AccessorieName"].ToString(); txtqty.Text = ds.Tables[1].Rows[0]["Quantity"].ToString(); for (int i = 1; i < count; i++) { hdnddlaccessories.Value = hdnddlaccessories.Value + "#" + ds.Tables[1].Rows[i]["AccessorieName"].ToString(); hdntxtqty.Value = hdntxtqty.Value + "#" + ds.Tables[1].Rows[i]["Quantity"].ToString(); } } } if (ds.Tables[2] != null) { for (int i = 0; i < ds.Tables[2].Rows.Count; i++) { CustomerLocationPic customerLocPic = new CustomerLocationPic(); customerLocPic.LocationPicture = ds.Tables[2].Rows[i]["LocationPicture"].ToString(); customerLocPic.RowSerialNo = Convert.ToInt32(ds.Tables[2].Rows[i]["RowSerialNo"]); customerLocationPicList.Add(customerLocPic); } ViewState[SessionKey.Key.PagedataTable.ToString()] = customerLocationPicList; hidCount.Value = customerLocationPicList.Count.ToString(); grvShutter.DataSource = ViewState[SessionKey.Key.PagedataTable.ToString()]; grvShutter.DataBind(); } } catch (Exception ex) { logManager.writeToLog(ex, "Custom", Request.ServerVariables["remote_addr"].ToString()); } }