//------------------------------------------------------------------------------------ protected void lvItems_ItemDataBound(object sender, ListViewItemEventArgs e) { ListViewDataItem lv = e.Item as ListViewDataItem; EF.ImportedPod ip = lv.DataItem as EF.ImportedPod; System.Web.UI.HtmlControls.HtmlAnchor imageFile = lv.FindControl("ancImage") as System.Web.UI.HtmlControls.HtmlAnchor; System.Web.UI.HtmlControls.HtmlInputCheckBox chkDelete = lv.FindControl("chkDelete") as System.Web.UI.HtmlControls.HtmlInputCheckBox; if (lv.ItemType == ListViewItemType.DataItem) { // ImportedPods is the virtual directory. if this is not working make sure the virtual directory is present if (chkDelete != null && ip != null) { chkDelete.Attributes.Add("ImportedPodId", ip.ImportedPodId.ToString()); } if (imageFile != null && ip != null) { string virtualPath = Server.MapPath("~/ImportedPods"); string actualPath = "/ImportedPods" + Path.Combine(ip.ImageFolder.Replace(virtualPath, ""), ip.ImageName); imageFile.HRef = actualPath; } } }
protected void Button5_Click(object sender, EventArgs e) { SqlDataSourceChain.Delete(); for (int i = 0; i < GridView3.Rows.Count; i++) { TableCell TableCell1 = (TableCell)GridView3.Rows[i].Cells[0]; CheckBox CheckBox1 = (CheckBox)TableCell1.FindControl("CheckBox1"); if (!CheckBox1.Checked) { continue; } HiddenField HiddenField2 = (HiddenField)TableCell1.FindControl("HiddenField2"); ListView ListView3 = (ListView)TableCell1.FindControl("ListView3"); SqlDataSourceChain.InsertParameters["IdParentQuest"].DefaultValue = HiddenField2.Value; int cnt_answer_checked = 0; for (int j = 0; j < ListView3.Items.Count; j++) { ListViewDataItem ListItem1 = (ListViewDataItem)ListView3.Items[j]; CheckBox ActiveCheckBox = (CheckBox)ListItem1.FindControl("ActiveCheckBox"); if (!ActiveCheckBox.Checked) { continue; } HiddenField HiddenField3 = (HiddenField)ListItem1.FindControl("HiddenField3"); SqlDataSourceChain.InsertParameters["IdParentAnswer"].DefaultValue = HiddenField3.Value; SqlDataSourceChain.Insert(); cnt_answer_checked++; } if (cnt_answer_checked == 0) { SqlDataSourceChain.Insert(); } } }
//------------------------------------------------------------------------------------ #endregion //------------------------------------------------------------------------------------ #region ListViews //------------------------------------------------------------------------------------ protected void lvAdditional_ItemDataBound(object sender, ListViewItemEventArgs e) { ListViewDataItem lv = e.Item as ListViewDataItem; DataRow dr = lv.DataItem as DataRow; if (lv.ItemType == ListViewItemType.DataItem) { CheckBox chkExclude = lv.FindControl("chkExcludeAdditional") as CheckBox; if (chkExclude != null) { chkExclude.Attributes.Add("OrderId", dr["OrderId"].ToString()); chkExclude.Attributes.Add("OrderStatus", dr["OrderStatus"].ToString()); if (dr["PreinvoiceId"] == DBNull.Value && dr["InvoiceId"] == DBNull.Value) { chkExclude.Attributes.Add("CanBeInvoiced", true.ToString()); } else { chkExclude.Attributes.Add("CanBeInvoiced", false.ToString()); } } HtmlTableCell statusCell = lv.FindControl("statusCell") as HtmlTableCell; if (dr["InvoiceId"] != DBNull.Value || dr["PreinvoiceId"] != DBNull.Value) { if (statusCell != null) { statusCell.BgColor = "#F6FF00"; //yellow - invoiced statusCell.InnerText = "I"; } } } }
protected void lvMaterialList_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem currentItem = (ListViewDataItem)e.Item; Material material = (Material)((ListViewDataItem)(e.Item)).DataItem; Label lblMaterialCode = (Label)currentItem.FindControl("lblMaterialCode"); Label lblQuantity = (Label)currentItem.FindControl("lblQuantity"); Label lblUnit = (Label)currentItem.FindControl("lblUnit"); Label lblMaterialID = (Label)currentItem.FindControl("lblMaterialID"); lvRowCount += 1; Label lblSerialNo = (Label)currentItem.FindControl("lblSerialNo"); //lblSerialNo.Text = lvRowCount.ToString(); Material materialDetail = (Material)((ListViewDataItem)(e.Item)).DataItem; lblMaterialCode.Text = materialDetail.MaterialCode.ToString(); lblQuantity.Text = materialDetail.MaterialQuantity.ToString(); //lblUnit.Text = ddlMeasurementUnit.SelectedItem.ToString(); lblUnit.Text = materialDetail.Unit; lblMaterialID.Text = materialDetail.MaterialID.ToString(); } }
protected void lvAllBrandList_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem currentItem = (ListViewDataItem)e.Item; Customer customer = (Customer)((ListViewDataItem)(e.Item)).DataItem; //LinkButton lnkbtnName = (LinkButton)currentItem.FindControl("lnkbtnName");lblName Label lblName = (Label)currentItem.FindControl("lblName"); Label lblCUstomerIDNo = (Label)currentItem.FindControl("lblCUstomerIDNo"); Label lblDepartment = (Label)currentItem.FindControl("lblDepartment"); Label lblDesignation = (Label)currentItem.FindControl("lblDesignation"); Label lblMobileNo = (Label)currentItem.FindControl("lblMobileNo"); Label lblCustomerID = (Label)currentItem.FindControl("lblCustomerID"); LinkButton lnkEdit = (LinkButton)currentItem.FindControl("lnkEdit"); LinkButton lnkMeasurement = (LinkButton)currentItem.FindControl("lnkMeasurement"); lvRowCount += 1; Label lblSerialNo = (Label)currentItem.FindControl("lblSerialNo"); //lblSerialNo.Text = lvRowCount.ToString(); //lnkbtnName.Text = customer.Name; lblName.Text = customer.Name; lblCUstomerIDNo.Text = customer.CustomerIDNo; lblDepartment.Text = customer.Department; lblDesignation.Text = customer.Designation; lblMobileNo.Text = customer.MobileNo; lblCustomerID.Text = customer.CustomerID.ToString(); //lnkbtnName.CommandArgument = customer.CustomerID.ToString(); //lnkbtnName.CommandName = "LoadBrand"; lnkEdit.CommandArgument = customer.CustomerID.ToString(); lnkEdit.CommandName = "EditCustomer"; lnkMeasurement.CommandArgument = customer.CustomerID.ToString(); lnkMeasurement.CommandName = "CustomerMeasurement"; } }
//-----------------------------------step 2------------------------------------ //view class times cliock protected void btnViewClassTime_Click(object sender, EventArgs e) { ListViewDataItem clickedModule = ((Button)sender).NamingContainer as ListViewDataItem; string moduleName = ((Label)clickedModule.FindControl("lblModuleTitle")).Text; string moduleId = ((Label)clickedModule.FindControl("lblModuleId")).Text; lblModalTitle.Text = "Class Times - " + moduleName; Session["s_moduleIdForTimetable"] = moduleId; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal();", true); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "progressBar", "$('.progress-bar').css('width', 33+'%').attr('aria-valuenow', valeur);", true); }
public void btnChargeBack_OnClick(object sender, CommandEventArgs e) { LinkButton linkViewRequest = (LinkButton)sender; ListViewDataItem listItem = (ListViewDataItem)linkViewRequest.Parent; ListView listDetails = (ListView)listItem.FindControl("lvDetails"); Label lblDisbursementCode = (Label)listItem.FindControl("lblDisbursementCode"); Disbursement d = sClerkCtrl.GetDisbursement(lblDisbursementCode.Text); d.Status = "charged back"; sClerkCtrl.UpdateDisbursement(d); BindGrid(ddlStatus.SelectedValue); }
protected void lvSearch_ItemDeleting(object sender, ListViewDeleteEventArgs e) { try { ListViewDataItem lvd = lvSearch.Items[e.ItemIndex]; Label lbl = (Label)lvd.FindControl("lblSNo"); int sno = Convert.ToInt32(lbl.Text.Trim()); con.Open(); SqlCommand cmddelFile = new SqlCommand("select FilePath+FileName from tbl_trx_duediligence where FileNo='" + ddlidf.SelectedValue + "' and Sno='" + sno + "'", con); string fn = cmddelFile.ExecuteScalar().ToString(); SqlCommand cmddel = new SqlCommand("delete from tbl_trx_duediligence where FileNo='" + ddlidf.SelectedValue + "' and Sno='" + sno + "'", con); if (cmddel.ExecuteNonQuery() == 1) { if (System.IO.File.Exists(fn)) { System.IO.File.Delete(fn); ClientScript.RegisterStartupScript(GetType(), "Information", "<script>alert('File Deleted')</script>"); } } con.Close(); } catch (Exception ex) { ClientScript.RegisterStartupScript(GetType(), "File Number and Sno Is Not Found", "<script>alert('Contract Number Is Not Found')</script>"); con.Close(); } }
protected void del_box_Click(object sender, ImageClickEventArgs e) { ImageButton imgbtn = (ImageButton)sender; ListViewDataItem clickedItem = (ListViewDataItem)imgbtn.NamingContainer; string delID = ((Label)clickedItem.FindControl("lblTenderId")).Text; con.Open(); string strdel1 = "DELETE from tenders WHERE id = '" + delID + "' "; string strdel2 = @"DELETE tenders_items FROM tenders_items T_Itms INNER JOIN tenders_waybills T_Wbs ON T_Wbs.id = T_Itms.waybill_id where tender_id = '" + delID + "' "; string strdel3 = "DELETE from tenders_waybills WHERE tender_id = '" + delID + "' "; SqlCommand strCmd1 = new SqlCommand(strdel1, con); SqlCommand strCmd2 = new SqlCommand(strdel2, con); SqlCommand strCmd3 = new SqlCommand(strdel3, con); int DTenders = strCmd1.ExecuteNonQuery(); int DTendersItems = strCmd2.ExecuteNonQuery(); int DTendersWaybills = strCmd3.ExecuteNonQuery(); if (DTenders != 0 && DTendersItems != 0 && DTendersWaybills != 0) { Response.Write("<SCRIPT language='JavaScript'> alert('წაშლა შესრულდა წარმატებით!') </SCRIPT>"); Response.Redirect("?action=tenders#procurements"); //Response.Redirect(delID + ".aspx"); //Response.Redirect(Request.RawUrl); con.Close(); } else { Response.Write("<SCRIPT language='JavaScript'> alert('შეცდომა, წაშლა ვერ შესრულდა !!!') </SCRIPT>"); } }
protected void btnLike_Click(object sender, ImageClickEventArgs e) { if (Session["loginuser"] == null) { ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); } else { var x = sender as ImageButton; string UID = x.CommandName; string PID = x.Attributes["imgId"]; string liked = x.ImageUrl; if (liked == "/Images/unlike.png") { if (LikeClass.sendLike(UID, PID) == true) { x.ImageUrl = "/Images/like.png"; ListViewDataItem item = (ListViewDataItem)(sender as Control).NamingContainer; Label lblTLike = (Label)item.FindControl("lblTLike"); lblTLike.Text = SqlTask.getTotalLikeByPhoto(PID).ToString(); } } else if (liked == "/Images/like.png") { if (LikeClass.UnLike(UID, PID) == true) { x.ImageUrl = "/Images/unlike.png"; ListViewDataItem item = (ListViewDataItem)(sender as Control).NamingContainer; Label lblTLike = (Label)item.FindControl("lblTLike"); lblTLike.Text = SqlTask.getTotalLikeByPhoto(PID).ToString(); } } } }
protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e) { //get data passed from the button control using CommandArgument Label1.Text = "button press " + e.CommandArgument.ToString(); //getting data from controls on the select ListView row by pressing the button //get the row ListViewDataItem rowcontents = e.Item as ListViewDataItem; //get the contents of a textbox called CapacityTextBox on the ListView Label1.Text += " capacity is " + (rowcontents.FindControl("CapacityTextBox") as TextBox).Text.ToString(); //get the contents of a visible=false label called TableIDLabel on the ListView Label1.Text += " tableid is " + (rowcontents.FindControl("TableIDLabel") as Label).Text.ToString(); }