protected void btnBiggerHw_Click(object sender, EventArgs e) { Button btn = (Button)sender; DataListItem dli = (DataListItem)btn.NamingContainer; Panel pnl = (Panel)dli.FindControl("hwWrap"); popup.Visible = true; DataRow dr_hw = ch_homeworkSvc.GetHomework(Convert.ToInt32(pnl.ToolTip)); popupContainer.ToolTip = pnl.ToolTip; lbl_pro_name.Text = dr_hw["pro_name"].ToString(); lbl_les_name.Text = dr_hw["les_name"].ToString(); lbl_hr_name.Text = dr_hw["hr_name"].ToString(); lbl_editdate.Text = dr_hw["hw_editdate"].ToString(); lbl_deadlinedate.Text = dr_hw["hw_deadlinedate"].ToString(); lbl_txt.Text = dr_hw["hw_txt"].ToString(); lbl_timeleft.Text = dr_hw["hw_timeleft"].ToString(); }
protected void btnIrGeocio_Click(object sender, EventArgs e) { try { //string cod = dtlisNegocio.ID ; LinkButton btn = (LinkButton)sender; DataListItem item = (DataListItem)btn.NamingContainer; Label lb = (Label)item.FindControl("Label2"); lgNegocio = new LogicaNegocio(); csNegocio negocio = lgNegocio.SessionNegocio(int.Parse(lb.Text)); Session["Negocio"] = negocio; Response.Redirect("IndexServicioPropietario.aspx"); } catch (Exception ex) { throw ex; } }
protected void lnkUnAssign_Click(object sender, EventArgs e) { DataListItem dlItem = (DataListItem)((LinkButton)sender).Parent; GridView grv = (GridView)dlItem.FindControl("grdShiftStaff"); foreach (GridViewRow gr in grv.Rows) { if (((CheckBox)gr.Cells[0].FindControl("chkGuard")).Checked) { string mgaid = ((CheckBox)gr.Cells[0].FindControl("chkGuard")).ToolTip; SqlParameter[] para = new SqlParameter[1]; para[0] = new SqlParameter("@MGAID", long.Parse(mgaid)); dal.executeprocedure("usp_UnDeployMonthlyStaff", para); } } gvAvailableGuards.DataBind(); dlShiftAssignment.DataBind(); }
/*Button html mua ngay*/ protected void Buttonmuangay_Click(object sender, EventArgs e) { if (Request.Cookies["tendangnhap"] == null) { Server.Transfer("DangNhap.aspx"); } Button mua = (Button)sender; string mahang = mua.CommandArgument.ToString(); DataListItem item = (DataListItem)mua.Parent; string soluong = ((TextBox)item.FindControl("TextBox1")).Text; if (Request.Cookies["tendangnhap"] == null) { return; } string ten = Request.Cookies["tendangnhap"].Value; SqlConnection con = null; try { con = new SqlConnection(str); con.Open(); string query = "select * from donhang where mahang='" + mahang + "' and tendangnhap='" + ten + "'"; SqlCommand command = new SqlCommand(query, con); SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { reader.Close(); command = new SqlCommand("update donhang set soluong=soluong+" + soluong + " where tendangnhap='" + ten + "' and mahang='" + mahang + "'", con); } else { reader.Close(); command = new SqlCommand("insert into donhang(tendangnhap,mahang,soluong) values ('" + ten + "','" + mahang + "'," + soluong + ")", con); } command.ExecuteNonQuery(); } catch (SqlException ex) { Response.Write(ex.Message); } finally { con.Close(); } Server.Transfer("GioHangChinh.aspx"); }
protected void Button1_Click(object sender, EventArgs e) { Button mua = ((Button)sender); string masach = mua.CommandArgument.ToString(); DataListItem item = (DataListItem)mua.Parent; string soluong = ((TextBox)item.FindControl("Textbox1")).Text; if (Request.Cookies["TENDANGNHAP"] == null) { return; } string ten = Request.Cookies["TENDANGNHAP"].Value; SqlConnection sqlC = null; try { sqlC = new SqlConnection(address); sqlC.Open(); string q = "select * from DONHANG where TENDANGNHAP='" + ten + "' and MASACH='" + masach + "'"; SqlCommand sqlcommand = new SqlCommand(q, sqlC); SqlDataReader sqlR = sqlcommand.ExecuteReader(); if (sqlR.Read()) { sqlR.Close(); sqlcommand = new SqlCommand("Update DONHANG set SOLUONG=SOLUONG+'" + soluong + "' where TENDANGNHAP='" + ten + "' and MASACH='" + masach + "'", sqlC); } else { sqlR.Close(); sqlcommand = new SqlCommand("Insert into DONHANG (TENDANGNHAP,MASACH,SOLUONG) values ('" + ten + "','" + masach + "','" + soluong + "')", sqlC); } sqlcommand.ExecuteNonQuery(); } catch (SqlException ex) { Response.Write(ex.Errors); } finally { sqlC.Close(); }; }
private void GenerateBreadcrumb(DataListItem item) { Panel panel = (Panel)item.FindControl("uxBreadcrumbPanel"); string name = DataBinder.Eval(item.DataItem, "Name").ToString(); string departmentID = DataBinder.Eval(item.DataItem, "DepartmentID").ToString(); string urlName = DataBinder.Eval(item.DataItem, "UrlName").ToString(); string parentDepartmentID = DataBinder.Eval(item.DataItem, "ParentDepartmentID").ToString(); GenerateParent(parentDepartmentID, panel); HyperLink link = new HyperLink(); link.NavigateUrl = UrlManager.GetDepartmentUrl(departmentID, urlName); link.Text = name; link.CssClass = "SiteMapBreadcrumb"; panel.Controls.Add(link); GenerateDepartment(item, departmentID); }
protected void btnAddToCart_Command(object sender, CommandEventArgs e) { if (e.CommandName == "AddToCart") { if (Session["uid"] != null && Session["sessionid"] != null) { string[] commandArgs = ((Button)sender).CommandArgument.ToString().Split(new char[] { ',' }); string pid = commandArgs[0]; string cid = commandArgs[1]; string rid = commandArgs[2]; Button btnAddToCart = (Button)sender; DataListItem item = (DataListItem)btnAddToCart.NamingContainer; var ddlsize = (DropDownList)item.FindControl("ddlsize"); DB obj = new DB(); obj.UserSessionId = Session["sessionid"].ToString(); obj.EmpId = Session["uid"].ToString(); obj.ProdCId = cid; obj.ProdRId = rid; obj.ProdId = pid; if (ddlsize.Visible == true) { obj.ProdSize = ddlsize.SelectedValue; } //int i = obj.AddNewCartProdInfo(); //if (i > 0) //{ // ((Label)Master.FindControl("lblcountcart")).Text = (Convert.ToInt32(((Label)Master.FindControl("lblcountcart")).Text) + 1).ToString(); // //Button btncart = ddlPrdoDescription.FindControl("btnAddToCart") as Button; // //btncart.Enabled = false; //} } else { Response.Redirect("Login.aspx?pid=" + Session["pid"]); } } }
private void BindModelVersions(string currentVersion, DataListItem dlic) { DropDownList ddlModelCotnrol; //Bind Models Versions if (dlic != null) { ddlModel = (DropDownList)dlic.FindControl("ddlModelEdit"); } else { ddlModelCotnrol = ddlModel; } ddlModel.DataSource = CSFactory.GetAllVersion().FindAll(x => x.Title != currentVersion);//x.IsDynamic == false && ddlModel.DataTextField = "Title"; ddlModel.DataValueField = "VersionID"; ddlModel.DataBind(); ddlModel.Items.Insert(0, new ListItem("Select", "-1")); }
private void AddServices() { // iterate through all services List <int> ids = new List <int>(); foreach (DataListItem itemGroup in dlServers.Items) { DataList dlServices = (DataList)itemGroup.FindControl("dlServices"); if (dlServices != null) { for (int i = 0; i < dlServices.Items.Count; i++) { DataListItem itemService = dlServices.Items[i]; CheckBox chkSelected = (CheckBox)itemService.FindControl("chkSelected"); if (chkSelected != null && chkSelected.Checked) { int serviceId = (int)dlServices.DataKeys[i]; ids.Add(serviceId); } } } } // add virtual services try { int result = ES.Services.Servers.AddVirtualServices(PanelRequest.ServerId, ids.ToArray()); if (result < 0) { ShowResultMessage(result); return; } } catch (Exception ex) { ShowErrorMessage("VSERVER_ADD_SERVICES", ex); return; } // return Response.Redirect(EditUrl("ServerID", PanelRequest.ServerId.ToString(), "edit_server")); }
private void RemoveServices() { // iterate through all services List <int> ids = new List <int>(); foreach (DataListItem itemGroup in dlServiceGroups.Items) { DataList dlServices = (DataList)itemGroup.FindControl("dlServices"); if (dlServices != null) { for (int i = 0; i < dlServices.Items.Count; i++) { DataListItem itemService = dlServices.Items[i]; CheckBox chkSelected = (CheckBox)itemService.FindControl("chkSelected"); if (chkSelected != null && chkSelected.Checked) { int serviceId = (int)dlServices.DataKeys[i]; ids.Add(serviceId); } } } } // remove virtual services try { int result = ES.Services.Servers.DeleteVirtualServices(PanelRequest.ServerId, ids.ToArray()); if (result < 0) { ShowResultMessage(result); return; } } catch (Exception ex) { ShowErrorMessage("VSERVER_REMOVE_SERVICES", ex); return; } // rebind BindServices(); }
public string TRJavaScript(Control con) { bool bSwitch = false; //string color1 = "#ffffcc"; //string color2 = "#ccff99"; string tmp = ""; DataListItem dli = con as DataListItem; LinkButton btn = dli.FindControl("lnkNaslov") as LinkButton; string _js = //"bgcolor={0} onMouseover='rowcolor=this" + //".style.backgroundColor;this.style.backgroundColor" + //"=\"yellow\"; this.style.cursor = \"hand\"' " + //"onMouseout='this.style.backgroundColor=rowcolor;' " + " onclick='document.getElementById(\"{0}\").click();' "; tmp = bSwitch ? string.Format(_js, btn.ClientID) : string.Format(_js, btn.ClientID); bSwitch = !bSwitch; return(tmp); }
//Click add to cart menu protected void btn_Goclick(object sender, EventArgs e) { Button btn = (Button)sender; DataListItem item = (DataListItem)btn.NamingContainer; Label lblId = (Label)item.FindControl("LblID"); Label LblCode = (Label)item.FindControl("LblCode"); Label LblItemName = (Label)item.FindControl("LblItemName"); Label LblQty = (Label)item.FindControl("LblQty"); Label LblPrice = (Label)item.FindControl("LblPrice"); Label LblDisc = (Label)item.FindControl("LblDisc"); Label LblTotal = (Label)item.FindControl("LblTotal"); TextBox txtqty = (TextBox)item.FindControl("txtqty"); string ID = lblId.Text; string Code = LblCode.Text; string ItemName = LblItemName.Text; string Qty = txtqty.Text; // LblQty.Text; decimal QtyStock = Convert.ToDecimal(LblQty.Text); string Price = LblPrice.Text; string Disc = LblDisc.Text; // string Total = LblTotal.Text; decimal Total = Math.Round((Convert.ToDecimal(Price) - (Convert.ToDecimal(Price) * Convert.ToDecimal(Disc) / 100)) * Convert.ToDecimal(Qty), 2); //Code ItemsName Available_Qty Price Disc% Total DataTable dt = (DataTable)Session["valuereturn"]; dt.Rows.Add(Code, ItemName, Qty, Price, Disc, Total); grdSelectedItem.DataSource = dt; grdSelectedItem.DataBind(); // double tex = (Convert.ToDouble(lblsubTotal.Text) * 5) / 100; double tex = ((Convert.ToDouble(lblsubTotal.Text) * Convert.ToDouble(lblVatRate.Text)) / 100); // lbldisc.Text = pricetotal - lblVat.Text = Math.Round(tex, 2).ToString(); lbltotal.Text = (Convert.ToDouble(lblsubTotal.Text) + Convert.ToDouble(lblVat.Text)).ToString(); }
protected void LKAddtoCart_Click2(object sender, EventArgs e) { using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext()) { LinkButton brn = (LinkButton)sender; int ItemId = int.Parse(brn.ToolTip.ToString()); DataListItem item = (DataListItem)brn.NamingContainer; //Label lblId = (Label)item.FindControl("lblgrocer"); int P = int.Parse(((Label)item.FindControl("lblgrocer")).Text.ToString()); Session["groserid"] = P; if (Request.Cookies["ItemDetailsCookies"] != null) { if (Request.Cookies["ItemDetailsCookies"].Value != "") { HttpCookie reqCookies = Request.Cookies["ItemDetailsCookies"]; HttpCookie userCookie = new HttpCookie("ItemDetailsCookies"); DateTime now = DateTime.Now; // Set the cookie value. userCookie["ItemId"] = reqCookies["ItemId"].ToString(); userCookie.Expires = DateTime.Now.AddDays(Convert.ToInt32(10)); //userCookie["Username"] = reqCookies["Username"].ToString(); //userCookie["OfficeId"] = reqCookies["OfficeId"].ToString(); //userCookie["OfficeTypeId"] = reqCookies["OfficeTypeId"].ToString(); //userCookie["DistrictId"] = reqCookies["DistrictId"].ToString(); //userCookie["DivisionId"] = reqCookies["DivisionId"].ToString(); Session["ItemId"] = reqCookies["ItemId"].ToString(); //Session["Username"] = reqCookies["Username"].ToString(); //Session["OfficeId"] = reqCookies["OfficeId"].ToString(); //Session["OfficeTypeId"] = reqCookies["OfficeTypeId"].ToString(); //Session["DistrictId"] = reqCookies["DistrictId"].ToString(); //Session["DivisionId"] = reqCookies["DivisionId"].ToString(); Response.Cookies.Add(userCookie); } } Response.Redirect("~/AddToCart.aspx?ItemId=" + ItemId); // Response.Redirect("AddToCart.aspx=" + ProdId); } }
protected void DataListProfile_PreRender(object sender, EventArgs e) { try { DataListItem dli = this.DataListProfile.Controls[this.DataListProfile.Controls.Count - 1] as DataListItem; Label lblPass = dli.FindControl("lblPass") as Label; String pass = lblPass.Text; String enc = ""; int passlen = pass.Length; for (int i = 0; i < passlen; i++) { enc += "*"; } lblPass.Text = enc; } catch (Exception exc) { Response.Redirect("ErrorPage.aspx"); } }
protected void imgClick_Click(object sender, EventArgs e) { LinkButton templink = (LinkButton)sender; DataListItem item = (DataListItem)templink.NamingContainer; HtmlImage tempimage = (HtmlImage)item.FindControl("imgotherphoto"); //tempimage.Width = Convert.ToInt16(Panel1.Width.Value - 20); //tempimage.Height = Convert.ToInt16(Panel1.Height.Value - 20); imgLargeImage.Src = tempimage.Src; //Panel1.Controls.Add(new LiteralControl("<img src='" + tempimage.Src + "' style='width:470px; height:250px; float:left;'/>")); //Panel1..BackImageUrl = tempimage.Src; ModalPopupExtender.Show(); //ModalPopupExtender1.Show(); Panel1.Style.Add(HtmlTextWriterStyle.Display, "block"); //Panel2.Style.Add(HtmlTextWriterStyle.Display, "block"); /* code for assigning image url to the image ctrl in panel */ }
protected void lbtnAddToCart_Click(object sender, EventArgs e) { //Ép sender thành dạng linkbutton, sender là //control đã kích hoạt sự kiện, ở đây là linkbutton //nên ta ép được LinkButton btn = sender as LinkButton; //Lấy control chứa control linkbutton, bởi vì mình biết //nó là DataListItem nên cast sang được DataListItem selectedItems = (DataListItem)btn.NamingContainer; //Dùng hàm FindControl để tìm control có trong Item của ListView //Bởi vì ta đã edit template nên phải tìm thông qua Item thì mới //lấy đc dữ liệu từ các control có trong template đó, //vì control là control label nên ta ép sang label String name = ((Label)selectedItems.FindControl("lblName")).Text; carName.Add(name); //Response.Write("<script>alert('" + carName.Count + "')</script>"); }
protected void friendsDataList_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "unfriend") { DataListItem item = (DataListItem)(((Button)(e.CommandSource)).NamingContainer); string friendUserName = ((Label)item.FindControl("nameSearchLabel")).Text; SqlConnection c = new SqlConnection(ConfigurationManager.ConnectionStrings["UsersConnectionString"].ConnectionString); c.Open(); string deleteQuery1 = "delete from FriendTable where Uname='" + Session["Username"].ToString() + "' and friendusername = '******'"; string deleteQuery2 = "delete from FriendTable where Uname='" + friendUserName + "' and friendusername = '******'"; SqlCommand cmd1 = new SqlCommand(deleteQuery1, c); SqlCommand cmd2 = new SqlCommand(deleteQuery2, c); cmd1.ExecuteNonQuery(); cmd2.ExecuteNonQuery(); Response.Redirect("MyFriends.aspx"); } }
protected void DataList1_ItemCommand(object sender, DataListCommandEventArgs e) { if (e.CommandName == "call") { DataListItem item = (DataListItem)(((LinkButton)(e.CommandSource)).NamingContainer); string text = ((Label)item.FindControl("lblx")).Text; globalTag.tagidData = text; Server.Transfer("~/ResultProfile.aspx"); } else if (e.CommandName == "call1") { DataListItem item = (DataListItem)(((ImageButton)(e.CommandSource)).NamingContainer); string text = ((Label)item.FindControl("lblx")).Text; globalTag.tagidData = text; Server.Transfer("~/ResultProfile.aspx"); } }
protected void accept_btn_Click(object sender, EventArgs e) { string prodID = Request.QueryString["listID"].ToString(); string queryString = "?listID=" + prodID; Button btn = (Button)sender; DataListItem item = (DataListItem)btn.NamingContainer; Label lblId = (Label)item.FindControl("ListingBid_ID_lbl"); string ID = lblId.Text; //string prodID = ((Label)DataList1.SelectedItem.FindControl("ListingBid_ID_lbl")).Text; int n = declineAllMethod(prodID, "Declined"); int m = acceptDeclineMethod(ID, "Accepted"); int p = closeBidding(prodID, "Close"); Response.Redirect("listing.aspx?listID=" + prodID); }
protected void PaquetesDataList_SelectedIndexChanged(object sender, EventArgs e) { DataTable dt = new DataTable(); DataListItem Item = PaquetesDataList.Items[PaquetesDataList.SelectedIndex]; TextBox Descripcion = (TextBox)Item.FindControl("DescripcionTextBox"); Paquetes paquete = new Paquetes(); dt = paquete.Listado("*", "Descripcion='" + Descripcion.Text + "'", ""); Usuarios usuario = new Usuarios(); usuario = (Usuarios)Session["Usuarios"]; VentasPaquetes venta = new VentasPaquetes(); venta.PaqueteId = (int)dt.Rows[0]["Paqueteid"]; venta.EspaciosRestante = (int)dt.Rows[0]["Espacios"]; venta.UsuarioId = usuario.UsuarioId; // venta.Fecha= DateTime.Now.ToString("dd/MM/yyyy"); venta.Insertar(); Response.Redirect("/Registros/RegistroVehiculos.aspx"); }
protected void lnkUnAssign1_Click(object sender, EventArgs e) { DataAccessLayer dal = new DataAccessLayer(); DataListItem dlItem = (DataListItem)((LinkButton)sender).Parent; RadGrid grv = (RadGrid)dlItem.FindControl("grdShiftStaff1"); foreach (GridItem gr in grv.Items) { if (((CheckBox)gr.Cells[0].FindControl("chkGuard")).Checked) { string mgaid = ((CheckBox)gr.Cells[0].FindControl("chkGuard")).ToolTip; SqlParameter[] para = new SqlParameter[1]; para[0] = new SqlParameter("@MGAID", long.Parse(mgaid)); dal.executeprocedure("usp_UnDeployMonthlyStaff", para); } } //gvAvailableGuards.DataBind(); //dlShiftAssignment.DataBind(); gvAvailableSupervisor.DataBind(); dlShiftAssignment1.DataBind(); }
protected void Image1_Click(object sender, ImageClickEventArgs e) { //var button = sender as ImageButton; //var dataListItem = button.Parent as DataListItem; ////var hfield = dataListItem.FindControl("hfield") as HiddenField; //var hfield = Request.Form["hfield"].ToString(); //Session["ProjectName"] = button.AlternateText; //Session["ProjectId"] = hfield; //Response.Redirect("Project_Details"); ImageButton lnk = (ImageButton)sender; DataListItem row = (DataListItem)lnk.Parent.Parent; HiddenField hidfriendadd = (HiddenField)row.FindControl("hfield"); Session["ProjectName"] = lnk.AlternateText; Session["ProjectId"] = hidfriendadd.Value; Response.Redirect("Project_Details"); }
protected void ImgDown_Click(object sender, ImageClickEventArgs e) { ImageButton bt = (ImageButton)sender; DataListItem dli = (DataListItem)bt.NamingContainer; Label lb = (Label)dli.FindControl("lblImageId"); int id = Convert.ToInt32(lb.Text); byte[] bytes; string fileName, contentType; if (con.State != ConnectionState.Open) { con.Open(); } using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "select * from ImageGallary where ImageId=" + id; cmd.Connection = con; using (SqlDataReader sdr = cmd.ExecuteReader()) { sdr.Read(); bytes = (byte[])sdr["Image"]; contentType = sdr["ContentType"].ToString(); fileName = sdr["Filepath"].ToString(); } } Response.Clear(); Response.Buffer = true; Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = contentType; Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName); Response.BinaryWrite(bytes); Response.Flush(); Response.End(); con.Close(); }
private bool IsMatchQuantity(DataListItem item, out string errorMessage) { errorMessage = String.Empty; TextBox uxQuantityText = (TextBox)item.FindControl("uxQuantityText"); int quantity = ConvertUtilities.ToInt32(uxQuantityText.Text); int minQuantity = CurrentProduct.MinQuantity; int maxQuantity = CurrentProduct.MaxQuantity; if (minQuantity > quantity) { errorMessage = GetLanguageText("MinQuantity") + minQuantity; return(false); } if (maxQuantity != 0 && maxQuantity < quantity) { errorMessage = GetLanguageText("MaxQuantity") + maxQuantity; return(false); } return(true); }
protected void delImg_Click(object sender, ImageClickEventArgs e) { if (con.State != ConnectionState.Open) { con.Open(); } ImageButton bt = (ImageButton)sender; DataListItem dli = (DataListItem)bt.NamingContainer; Label lb = (Label)dli.FindControl("lblImageId"); int id = Convert.ToInt32(lb.Text); string deletequery = string.Empty; deletequery = "Delete from [ImageGallary] where [ImageId]=" + id; SqlCommand cmd = new SqlCommand(deletequery, con); int rowAffected = cmd.ExecuteNonQuery(); if (rowAffected > 0) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record Deleted Successfully')", true); } con.Close(); datasearching(); }
protected void dlrequest_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "View") { try { DataListItem item = (DataListItem)(((Control)(e.CommandSource)).NamingContainer); string email = ((Label)item.FindControl("lblemail")).Text; string mdate = e.CommandArgument.ToString(); DataTable dtgetProd = new DataTable(); if (hfType.Value == "SuperAdmin" || hfType.Value == "Admin") { dtgetProd = Lo.RetriveGridViewCompany(mdate.ToString(), email, hfType.Value, "RetReqProd"); } else { dtgetProd = Lo.RetriveGridViewCompany(mdate.ToString(), email, hfCompRefNo.Value, "RetReqProd"); } if (dtgetProd.Rows.Count > 0) { gvViewNodalOfficerAdd.DataSource = dtgetProd; gvViewNodalOfficerAdd.DataBind(); pan1.Visible = true; panview.Visible = false; ScriptManager.RegisterStartupScript(this, GetType(), "aboutus", "showPopup();", true); } else { ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "alert", "ErrorMssgPopup('No Record Found')", true); } } catch (Exception ex) { ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "alert", "ErrorMssgPopup('Error:- " + ex.Message.ToString() + ")", true); } } }
protected void txtProductQuantity_TextChanged(object sender, EventArgs e) { TextBox txtQuantity = (sender as TextBox); DataListItem currentitem = (sender as TextBox).NamingContainer as DataListItem; HiddenField ProductID = currentitem.FindControl("hfProductID") as HiddenField; if (txtQuantity.Text == string.Empty || txtQuantity.Text == "0" || txtQuantity.Text == "1") { txtQuantity.Text = "1"; } else { if (Session["MyCart"] != null) { DataTable dt = (DataTable)Session["MyCart"]; DataRow[] rows = dt.Select("ProductID ='" + ProductID.Value + "'"); int index = dt.Rows.IndexOf(rows[0]); dt.Rows[index]["ProductQuantity"] = txtQuantity.Text; Session["MyCart"] = dt; } } // UpdateTotalBill(); }
// ///// Open Options Popup panel protected void btnPopuOptions_Goclick(object sender, EventArgs e) { Button btn = (Button)sender; DataListItem item = (DataListItem)btn.NamingContainer; Label Lblpid = (Label)item.FindControl("lblpid"); Label Lblitemname = (Label)item.FindControl("lblitemname"); Label LblQty = (Label)item.FindControl("LblQty"); Label LblPrice = (Label)item.FindControl("LblPrice"); Label LblDisc = (Label)item.FindControl("LblDisc"); Label LblDescriptions = (Label)item.FindControl("LblDescriptions"); Image imgPhoto = (Image)item.FindControl("imgPhoto"); // TextBox txtqty = (TextBox)item.FindControl("txtqty"); // DropDownList txtqty = (DropDownList)item.FindControl("ddlQty"); Session["Code"] = Lblpid.Text; Session["ItemName"] = Lblitemname.Text; lblItemname.Text = Lblitemname.Text; // Session["Qty"] = txtqty.Text; // LblQty.Text; Session["QtyStock"] = Convert.ToDecimal(LblQty.Text); Session["Price"] = LblPrice.Text; Session["Disc"] = LblDisc.Text; Session["image"] = imgPhoto.ImageUrl; lblitemPrice.Text = LblPrice.Text; lbldescriptionsPop.Text = LblDescriptions.Text; chkoptionslist.SelectedIndex = -1; // this.ModalPopupOptions.Show(); // Session.Add("value", table); // Session.Remove("value"); System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(@"<script type='text/javascript'>"); sb.Append("$('#detailsmodal').modal('show');"); sb.Append(@"</script>"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "DetailModalScript", sb.ToString(), false); }
protected void btnUpdate_Click(object sender, EventArgs e) { try { lblEmpty.Visible = false; btnUpdate.Visible = false; btnDelete.Visible = false; btnCancel.Visible = true; btnSave.Visible = true; DataListItem dli = this.DataListProfile.Controls[this.DataListProfile.Controls.Count - 1] as DataListItem; Label lblName = dli.FindControl("lblName") as Label; Label lblID = dli.FindControl("lblID") as Label; Label lblCity = dli.FindControl("lblCity") as Label; Label lblRole = dli.FindControl("lblRole") as Label; Label lblDOB = dli.FindControl("lblDOB") as Label; Label lblGender = dli.FindControl("lblGender") as Label; Label lblMobile = dli.FindControl("lblMobile") as Label; Label lblEmail = dli.FindControl("lblEmail") as Label; Label lblPass = dli.FindControl("lblPass") as Label; Label lblConPass = dli.FindControl("lblConPass") as Label; TextBox txtName = dli.FindControl("txtName") as TextBox; TextBox txtCity = dli.FindControl("txtCity") as TextBox; TextBox txtDOB = dli.FindControl("txtDOB") as TextBox; TextBox txtMobile = dli.FindControl("txtMobile") as TextBox; TextBox txtEmail = dli.FindControl("txtEmail") as TextBox; TextBox txtPass = dli.FindControl("txtPass") as TextBox; TextBox txtConPass = dli.FindControl("txtConPass") as TextBox; DropDownList ddlRole = dli.FindControl("ddlRole") as DropDownList; DropDownList ddlGender = dli.FindControl("ddlGender") as DropDownList; lblName.Visible = lblCity.Visible = lblRole.Visible = lblDOB.Visible = lblGender.Visible = lblMobile.Visible = lblEmail.Visible = lblPass.Visible = false; txtName.Visible = txtCity.Visible = ddlRole.Visible = txtDOB.Visible = ddlGender.Visible = txtMobile.Visible = txtEmail.Visible = txtPass.Visible = lblConPass.Visible = txtConPass.Visible = true; ddlRole.SelectedValue = lblRole.Text; ddlGender.SelectedValue = lblGender.Text; } catch (Exception exc) { Response.Redirect("ErrorPage.aspx"); } }
private void EditTaxTotalStyle(DataListItem dataListItem, AirMaterial flight) { //TaxTotal Label lblAdultTaxTotal = (Label)dataListItem.FindControl("lblAdultTaxTotal"); Label lblChildTaxTotal = (Label)dataListItem.FindControl("lblChildTaxTotal"); if (flight.AdultTax == 0) { lblAdultTaxTotal.Visible = false; lblChildTaxTotal.Visible = false; } }
private Label GetExpansionControl(DataListItem flightItem) { return (Label)flightItem.FindControl("lb_showSamePrice"); }
private DataListItem GetLowestSelectFareItem(DataListItem lastdataListItem) { System.Web.UI.WebControls.Label currentLblLowFareSelect = null; System.Web.UI.WebControls.Label lowestLblLowFareSelect = null; IList airMatrixDataSource = null; DataListItem lowestSelectFareItem = null; DataListItem currentItem = null; //AirMatrixFlightMeta currentAirMatrix = null; //AirMatrixFlightMeta lowestAirMatrix = null; decimal currentFare = 0; decimal lowestFare = 0; //System.Web.UI.WebControls.Label lblLowFareSelect = (System.Web.UI.WebControls.Label)e.Item.FindControl("lblLowFareSelect"); lowestSelectFareItem = lastdataListItem; for (int itemIndex = 0; itemIndex < dlAirlineMatrics.Items.Count; itemIndex++) { currentItem = dlAirlineMatrics.Items[itemIndex]; //currentAirMatrix = AirMatrixList[itemIndex]; currentLblLowFareSelect = (System.Web.UI.WebControls.Label)currentItem.FindControl("lblLowFareSelect"); if (lowestSelectFareItem == null) { lowestSelectFareItem = currentItem; //lowestAirMatrix = currentAirMatrix; lowestLblLowFareSelect = (System.Web.UI.WebControls.Label)lowestSelectFareItem.FindControl("lblLowFareSelect"); } else { airMatrixDataSource = (IList)(((PagedDataSource)dlAirlineMatrics.DataSource).DataSource); if (((AirMatrixFlightMeta)(airMatrixDataSource)[currentItem.ItemIndex]).LowFareSelectPrice.BaseFare != 0) { currentFare = ((AirMatrixFlightMeta)(airMatrixDataSource)[currentItem.ItemIndex]).LowFareSelectPrice.BaseFare; } if (((AirMatrixFlightMeta)(airMatrixDataSource)[lowestSelectFareItem.ItemIndex]).LowFareSelectPrice.BaseFare != 0) { lowestFare = ((AirMatrixFlightMeta)(airMatrixDataSource)[lowestSelectFareItem.ItemIndex]).LowFareSelectPrice.BaseFare; } if (lowestFare == 0) { lowestSelectFareItem = currentItem; } else { if (currentFare > 0 && currentFare < lowestFare) { lowestSelectFareItem = currentItem; } } } } return lowestSelectFareItem; }
private void SetTotalDurationAndDistance(AirMaterial flight, DataListItem dataListItem) { System.Web.UI.WebControls.Label lblTotalDistance = (System.Web.UI.WebControls.Label)dataListItem.FindControl("lblTotalDistance"); lblTotalDistance.Text = GetDistance(flight); System.Web.UI.WebControls.Label lblTotalDuration = (System.Web.UI.WebControls.Label)dataListItem.FindControl("lblTotalDuration"); lblTotalDuration.Text = GetDuration(flight); System.Web.UI.WebControls.Label lblTotalDistanceMsg = (System.Web.UI.WebControls.Label)dataListItem.FindControl("lblTotalDistanceMsg"); if (lblTotalDuration.Text.Trim() == string.Empty) { lblTotalDistanceMsg.Visible = false; } }
private Panel GetWholeFlightItemControl(DataListItem flightItem) { return (Panel)flightItem.FindControl("pnlWholeFlightItem"); }
private Label GetShrinkControl(DataListItem flightItem) { return (Label)flightItem.FindControl("lb_hideSamePrice"); }
protected void btnSave_Click(object sender, EventArgs e) { try { DataListItem dli = this.DataListProfile.Controls[this.DataListProfile.Controls.Count - 1] as DataListItem; Label lblID = dli.FindControl("lblID") as Label; TextBox txtName = dli.FindControl("txtName") as TextBox; TextBox txtCity = dli.FindControl("txtCity") as TextBox; TextBox txtDOB = dli.FindControl("txtDOB") as TextBox; TextBox txtMobile = dli.FindControl("txtMobile") as TextBox; TextBox txtEmail = dli.FindControl("txtEmail") as TextBox; TextBox txtPass = dli.FindControl("txtPass") as TextBox; TextBox txtConPass = dli.FindControl("txtConPass") as TextBox; DropDownList ddlRole = dli.FindControl("ddlRole") as DropDownList; DropDownList ddlGender = dli.FindControl("ddlGender") as DropDownList; String id = lblID.Text; String myConn = ConfigurationManager.ConnectionStrings["StayHubDBConnection"].ConnectionString; SqlConnection con = new SqlConnection(myConn); String query = "update Users set " + "Name = @Name, " + "City = @City, " + "Role = @Role, " + "DOB = @DOB, " + "Gender = @Gender, " + "Mobile = @Mobile, " + "Email = @Email, " + "Password = @Password " + " where ID = @ID"; SqlCommand cmd = new SqlCommand(query, con); cmd.Parameters.AddWithValue("ID", id); cmd.Parameters.AddWithValue("Name", txtName.Text); cmd.Parameters.AddWithValue("City", txtCity.Text); cmd.Parameters.AddWithValue("Role", ddlRole.SelectedValue); cmd.Parameters.AddWithValue("DOB", txtDOB.Text); cmd.Parameters.AddWithValue("Gender", ddlGender.SelectedValue); cmd.Parameters.AddWithValue("Mobile", txtMobile.Text); cmd.Parameters.AddWithValue("Email", txtEmail.Text); cmd.Parameters.AddWithValue("Password", txtPass.Text); con.Open(); cmd.ExecuteNonQuery(); con.Close(); lblEmpty.Text = "Profile Updated Successfully"; lblEmpty.ForeColor = System.Drawing.Color.Green; lblEmpty.Visible = true; DataListProfile.DataBind(); SwapLabels(); btnCancel.Visible = false; btnSave.Visible = false; btnUpdate.Visible = true; btnDelete.Visible = true; } catch (Exception exc) { Response.Redirect("ErrorPage.aspx"); } }
private void EditItemToSelectContactStyle(DataListItem dataListItem) { //DisplayMoney Label lblDisplayMoney = (Label)dataListItem.FindControl("lblDisplayMoney"); lblDisplayMoney.Visible = false; //PerPerson Label lblPerPerson = (Label)dataListItem.FindControl("lblPerPerson"); lblPerPerson.Visible = false; //TaxTotal Label lblAdultTaxTotal = (Label)dataListItem.FindControl("lblAdultTaxTotal"); lblAdultTaxTotal.Visible = false; Label lblChildTaxTotal = (Label)dataListItem.FindControl("lblChildTaxTotal"); lblChildTaxTotal.Visible = false; //imgAirline System.Web.UI.WebControls.Image AirImgRtn1 = (System.Web.UI.WebControls.Image)dataListItem.FindControl("AirImgRtn1"); AirImgRtn1.Visible = false; System.Web.UI.WebControls.Image imgAirlineSelect = (System.Web.UI.WebControls.Image)dataListItem.FindControl("imgAirlineSelect"); imgAirlineSelect.Visible = true; Label lblAirlineSpace = (Label)dataListItem.FindControl("lblAirlineSpace"); lblAirlineSpace.Visible = true; }