public string BindHerd(RepeaterItem Container) { string td = ""; if (Container == null) return td; DataColumn dc = Container.DataItem as DataColumn; if (dc == null) return td; string sty = ""; string tit = dc.ColumnName; DateTime dt = DateTime.MinValue; m_HeadTdIndex++; if (tit == "序号") { m_HeadTdLeft = 5; sty = "style='width:40px;height:45px;position:relative;'"; td += "<td id='xuhao' class='headtit' " + sty + ">" + "\n"; td += " 序号" + "\n"; td += "</td>" + "\n"; m_HeadTdLeft += 40; } else if (tit == "姓名") { sty = "style='width:80px;height:45px;position:relative;'"; td += "<td id='drawXiexian' class='headtit' " + sty + ">" + "\n"; td += " <table>" + "\n";//style='background-image:url(Uploadify/xiexian.gif)' td += " <tr>" + "\n"; td += " <td style='text-align:right;border: 0px none #000;'>日期</td>" + "\n"; td += " </tr>" + "\n"; td += " <tr>" + "\n"; td += " <td style='text-align:left;border: 0px none #000;'>姓名</td>" + "\n"; td += " </tr>" + "\n"; td += " </table>" + "\n"; td += "</td>" + "\n"; m_HeadTdLeft += 80; } else if (tit == "全勤") { sty = "style='width:40px;height:45px;position:relative;'"; td += "<td class='headtit' " + sty + ">" + "\n"; td += " " + tit + "\n"; td += "</td>" + "\n"; m_HeadTdLeft += 40; } else if (tit == "实际出勤") { sty = "style='width:40px;height:45px;position:relative;'"; td += "<td class='headtit' " + sty + ">" + "\n"; td += " <table>" + "\n"; td += " <tr>" + "\n"; td += " <td style='border: 0px none #000;'>实际</td>" + "\n"; td += " </tr>" + "\n"; td += " <tr>" + "\n"; td += " <td style='border: 0px none #000;'>出勤</td>" + "\n"; td += " </tr>" + "\n"; td += " </table>" + "\n"; td += "</td>" + "\n"; m_HeadTdLeft += 40; } else if (DateTime.TryParse(tit, out dt)) { sty = "style='text-align:left;width:25px; min-width:25px;max-width:25px;position:relative;'"; td += "<td class='headtit' " + sty + ">" + "\n"; td += " <table>" + "\n"; td += " <tr>" + "\n"; td += " <td style='border: 0px none #000;border-bottom:1px solid #aad;'>" + dt.Day.ToString().PadLeft(2, '0') + "</td>" + "\n"; td += " </tr>" + "\n"; td += " <tr>" + "\n"; td += " <td style='border: 0px none #000;'>" + CheckInOutHelper.ChineseByEnWeek(dt) + "</td>" + "\n"; td += " </tr>" + "\n"; td += " </table>" + "\n"; td += "</td>" + "\n"; m_HeadTdLeft += 25; } else if (!m_HeadTdDayShowOver) { m_HeadTdColspan = m_HeadTdCount - m_HeadTdIndex + 1; sty = "style='width:" + (38 * 15 + 14) + "px;position:relative;'"; td += "<td class='headtit' " + sty + ">" + "\n"; td += "<table>" + "\n"; td += "<tr>" + "\n"; td += " <td colspan=\"" + m_HeadTdColspan + "\" style='border: 0px none #000;border-bottom:1px solid #aad; text-align:left;'>出勤情况<td>" + "\n"; td += "</tr>" + "\n"; td += "<tr>"; sty = "style='width:" + (tit.Length * 15 + 5) + "px; border: 0px none #000;border-right: 1px solid #aad;'"; td += "<td " + sty + ">" + "\n"; td += " " + tit + "\n"; td += "</td>" + "\n"; m_HeadTdLeft += 38 * 15 + 14; m_HeadTdDayShowOver = true; } else if (m_HeadTdIndex == m_HeadTdCount) { sty = "style='width:" + (tit.Length * 15 + 5) + "px;border: 0px none #000;border-right: 1px solid #aad;'"; td += "<td " + sty + ">" + "\n"; td += " " + tit + "\n"; td += "</td>" + "\n"; td += "</tr>" + "\n"; td += "</table>" + "\n"; td += "</td>" + "\n"; } else { sty = "style='width:" + (tit.Length * 15 + 5) + "px;border: 0px none #000;border-right: 1px solid #aad;'"; td += "<td " + sty + ">" + "\n"; td += " " + tit + "\n"; td += "</td>" + "\n"; } return td; }
private void RepeaterItem(RepeaterItem e) { if (e.ItemType == ListItemType.Item || e.ItemType == ListItemType.AlternatingItem) { try { ImageButton lbtnDelete = (ImageButton)e.FindControl("deleteImage"); HtmlImage image = (HtmlImage)e.FindControl("imgDelete"); //if (Common.ExistServiceTypeIdForMessageContent(Convert.ToInt32(lbtnDelete.CommandArgument)) == true) //{ // lbtnDelete.Enabled = false; //} //else //{ lbtnDelete.Enabled = true; lbtnDelete.Attributes["onClick"] = "confirmAction(event, '" + Resources.UIResource.ConfirmDeleteServiceType + "');"; //} } catch (Exception ex) { // Logger.Error(ex.Message); //this.latestException = ex; } } }
protected String GetCommentReplyHtml(Comment comment, RepeaterItem item) { CommentReplyManager manager = new CommentReplyManager(); IList<CommentReply> replyes = manager.GetCommentReplyByCommentID(comment.ID); HtmlGenericControl divReply = item.FindControl("divReply") as HtmlGenericControl; HyperLink hplReply = item.FindControl("hplReply") as HyperLink; if (replyes != null && replyes.Count > 0) { ///Show the Reply Link divReply.Visible = true; hplReply.Attributes["onclick"] = String.Format("ShowPopupForCommentReply({0}, this);", comment.ID); UserManager userManager = new UserManager(); StringBuilder sb = new StringBuilder(10); #region Expand Collapse Implementation //sb.Append("Comment Replyes:"); //foreach (CommentReply reply in replyes) //{ // PlanningPrepUser user = userManager.Get(reply.UserID); // sb.Append("<div style='margin-top:10px;'>"); // sb.Append("<div class='ExamTitle' onclick='ToggleCollapse(this)' style='cursor:pointer'>"); // sb.AppendFormat("<img class='clickableimage' src='/Images/plus.gif' alt='Expand' title='Expand'/> {0}", user.Username); // sb.Append("</div>"); // sb.AppendFormat("<div class='replymessage' style='display:none;'>{0}</div>", AppUtil.FormatText(reply.Message)); // sb.Append("</div>"); //} #endregion for(int i=0; i<replyes.Count; i++) { CommentReply reply = replyes[i]; PlanningPrepUser user = userManager.Get(reply.UserID); if (i == 0) sb.Append("<div class='replymessagecontainer' style='margin-top:10px;'>"); else sb.Append("<div class='replymessagecontainer'>"); sb.AppendFormat("<div class='replymessageheading'>Reply of <b>{0}</b></div>", AppUtil.Encode(string.Format("{0} {1}",user.FirstName,user.LastName))); sb.Append(string.Format("\"{0}\"", AppUtil.FormatText(reply.Message))); sb.Append("</div>"); } return sb.ToString(); } else { ///Show the Reply Link if this commment is not the users own comment if (comment.UserID != _LoggedInUser.Author_ID) { divReply.Visible = true; hplReply.Attributes["onclick"] = String.Format("ShowPopupForCommentReply({0}, this);", comment.ID); } } if (_LoggedInUser.Author_ID == 0) divReply.Visible = false; return String.Empty; }
public RepeaterCommandEventArgs ( RepeaterItem item, object source, CommandEventArgs args) : base (args) { this.item = item; this.source = source; }
public string BindRow(RepeaterItem Container) { if (Container == null) return ""; Repeater rep = Container.FindControl("repRow") as Repeater; if (rep == null) return ""; DataRow dr = Container.DataItem as DataRow; if (dr == null || dr.ItemArray.Length < 3) return ""; DateTime dt = DateTime.Now; rep.DataSource = dr.ItemArray; rep.DataBind(); return dr[0].ToString(); //if (dr[0].ToString() == dt.Year + "-" + dt.Month.ToString().PadLeft(2, '0') + "-" + dt.Day.ToString().PadLeft(2, '0')) // return " style='background-color:#5e5e5e;' "; //else // return ""; }
public string BindBody(RepeaterItem Container) { if (Container == null || Container.DataItem == null) return ""; colIndex++; string sty = ""; if (m_HeadTdCount - colIndex == m_HeadTdColspan - 1) { return "<td " + sty + "><table><tr><td>" + Container.DataItem.ToString() + "</td>"; } else if (m_HeadTdCount - colIndex < m_HeadTdColspan - 1) { return "<td>" + Container.DataItem.ToString() + "</td>"; } else if (m_HeadTdCount == colIndex) { colIndex = 0; return "<td>" + Container.DataItem.ToString() + "</td></tr></table></td>"; } return "<td " + sty + ">" + Container.DataItem.ToString() + "</td>"; }
protected void SetSubNav(RepeaterItem container, Guid rootContentID) { Control ctrl = FindSubControl(container); if (ctrl == null) { ctrl = new ListItemPlaceHolder(); container.Controls.Add(ctrl); } else { Control ctrl2 = FindSubControl(ctrl); if (ctrl2 != null) { ctrl = ctrl2; } } List <SiteNav> lstNav = GetChildren(rootContentID); if (lstNav != null && lstNav.Any()) { ListItemRepeater rSubNav = new ListItemRepeater(); rSubNav.ID = "rSubNav"; rSubNav.HeaderTemplate = SubNavHeaderTemplate; rSubNav.ItemTemplate = SubNavTemplate; rSubNav.FooterTemplate = SubNavFooterTemplate; ctrl.Controls.Add(rSubNav); rSubNav.DataSource = lstNav; rSubNav.DataBind(); rSubNav.EnableViewState = this.EnableViewState; UpdateHyperLink(rSubNav); } }
protected void item_delete_Click(object sender, EventArgs e) { Button btn = (Button)sender; RepeaterItem rItem = (RepeaterItem)btn.NamingContainer; ArrayList wishlist = (ArrayList)Session["Wishlist"]; if (wishlist != null) { Label productIDLabel = (Label)rItem.FindControl("product_id"); int productID = Int32.Parse(productIDLabel.Text); for (int i = 0; i < wishlist.Count; i++) { if ((int)wishlist[i] == productID) { wishlist.RemoveAt(i); } } Session["Wishlist"] = wishlist; RebindWishlist(); } }
protected void lbExpand_Click(object sender, EventArgs e) { LinkButton lbExpand = sender as LinkButton; RepeaterItem ri = (RepeaterItem)lbExpand.NamingContainer; string hfIDProductCategory = ((HiddenField)ri.FindControl("hfIDProductCategory")).Value; HiddenField hfExpand = (HiddenField)ri.FindControl("hfExpand"); bool Expand = hfExpand.Value.StringToBool(); hfExpand.Value = (!Expand).ToString(); Repeater rptProductCategory = (Repeater)ri.FindControl("rptProductCategory"); Repeater rptMasterProduct = ((Repeater)ri.FindControl("rptMasterProduct")); if (Expand) { lbExpand.Text = "<i class='fa fa-plus' style='font-size:15px'></i>"; if (rptProductCategory != null) { rptProductCategory.DataSource = null; rptProductCategory.DataBind(); } rptMasterProduct.DataSource = null; rptMasterProduct.DataBind(); } else { lbExpand.Text = "<i class='fa fa-minus' style='font-size:15px'></i>"; if (rptProductCategory != null) { ViewModel.Search SearchProductCategory = new ViewModel.Search(); SearchProductCategory.Filter = " AND tblProductCategory.ParentID = '" + hfIDProductCategory + "'"; SearchProductCategory.Order = " ORDER BY tblProductCategory.[Order]"; DataSet dsProductCategory = BisProductCategory.GetProductCategoryDataShowInTree(SearchProductCategory); rptProductCategory.DataSource = dsProductCategory; rptProductCategory.DataBind(); } FillRptMasterProduct(rptMasterProduct, hfIDProductCategory); } }
protected void rptGroup_ItemDataBound(object sender, RepeaterItemEventArgs e) { try { RepeaterItem item = e.Item; if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { string id = DataBinder.Eval(item.DataItem, "Id").ToString(); string itemCnt = DataBinder.Eval(item.DataItem, "Items").ToString(); DataTable dtPro = ProductService.Product_GetByTop("10", "Active = 1 AND GroupId=" + id, "Id DESC"); if (dtPro.Rows.Count == 0) { item.Visible = false; } Repeater rptPro = (Repeater)item.FindControl("rptPro"); Repeater rptProducts04 = (Repeater)item.FindControl("rptProducts04"); if (rptPro != null) { HttpCookie cookie = Request.Cookies[Consts.GUID_SHOPPING_CART]; switch (itemCnt) { case "4": rptProducts04.DataSource = StringClass.ModifyDataProduct(dtPro, cookie); rptProducts04.DataBind(); break; default: rptPro.DataSource = StringClass.ModifyDataProduct(dtPro, cookie); rptPro.DataBind(); break; } } } } catch (Exception ex) { MailSender.SendMail("", "", "Error System", ex.Message + "\n" + ex.StackTrace); } }
protected void OnUpdating(object sender, EventArgs e) { // Label3 RepeaterItem item = (sender as LinkButton).Parent as RepeaterItem; TextBox txtName = (TextBox)item.FindControl("TextBox1"); TextBox txtCountry = (TextBox)item.FindControl("TextBox2"); DropDownList lstCounties = item.FindControl("DropDownList1") as DropDownList; String _Name = txtName.Text; String _Country = txtCountry.Text; Label lbId = item.FindControl("Label3") as Label; SqlConnection _Conn = new SqlConnection(@"Data Source=FACULTY18;Initial Catalog=CUSTOMERINFO;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"); _Conn.Open(); SqlCommand _cmd = new SqlCommand("UPDATE CUSTOMERS SET NAME =@NAME,COUNTRY=@COUNTRY WHERE CustomerId = @ID", _Conn); _cmd.Parameters.AddWithValue("@NAME", _Name); _cmd.Parameters.AddWithValue("@COUNTRY", lstCounties.SelectedItem.Value); _cmd.Parameters.AddWithValue("@ID", lbId.Text); _cmd.ExecuteNonQuery(); DataBinder(); }
protected void get_total_price(object sender, EventArgs e) { TextBox tb1 = ((TextBox)(sender)); RepeaterItem rp1 = ((RepeaterItem)(tb1.NamingContainer)); TextBox qnt = (TextBox)rp1.FindControl("quntity_tb"); Label price = (Label)rp1.FindControl("price_lbl"); Label total_lbl = (Label)rp1.FindControl("total_lbl"); if (Convert.ToInt32(qnt.Text) <= 0) { ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('Please Enter Quntity');", true); total_lbl.Text = ""; qnt.Text = "1"; total_lbl.Text = price.Text.ToString(); } else { int tot_price = Convert.ToInt32(qnt.Text) * Convert.ToInt32(price.Text); total_lbl.Text = tot_price.ToString(); refersh(); } }
public void R1_ItemCommand(Object sender, RepeaterCommandEventArgs e) { RepeaterItem item = ((Button)e.CommandSource).Parent as RepeaterItem; string carId = (item.FindControl("lblCarId") as Label).Text; string carName = (item.FindControl("lblVehName") as Label).Text; string carPrice = (item.FindControl("lblPrice") as Label).Text; string carYear = (item.FindControl("lblYear") as Label).Text; string carFuel = (item.FindControl("lblFuel") as Label).Text; string carTransmition = (item.FindControl("lblTransmition") as Label).Text; string carKmDriven = (item.FindControl("lblKmDriven") as Label).Text; Session["carId"] = carId; Session["carname"] = carName; Session["price"] = carPrice; Session["year"] = carYear; Session["fuel"] = carFuel; Session["transmition"] = carTransmition; Session["driven"] = carKmDriven; Response.Redirect("BookingForm.aspx"); }
protected void BtnSaveClick(object sender, EventArgs e) { RadButton btn = (RadButton)sender; RepeaterItem item = (RepeaterItem)btn.NamingContainer; HiddenField hfId = (HiddenField)item.FindControl("hfThisHistory"); HistoriaMedicaBll objbll = new HistoriaMedicaBll(); HistoriaMedica objEnt = objbll.Load(Convert.ToInt32(hfId.Value)); objEnt.Finalizada = true; objEnt.IdUltimaModificacion = this.IdUserCurrent; objEnt.FechaUltimaModificacion = DateTime.Now; if (!objbll.Save(objEnt, null)) { RadScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Errclosisng", "alert('Se ha presentado el siguiente error al cerrar la historia:\\n\\n" + Utilidades.AjustarMensajeError(objbll.Error) + "');", true); } else { Response.Redirect(ResolveUrl("~/Cierre.aspx"), true); } ReloadRepeater(); }
protected void Fillcontent(object sender, EventArgs e) { RepeaterItem a = ((TextBox)sender).NamingContainer as RepeaterItem; string b = a.ItemIndex.ToString(); if (b == "0") { TextBox txt = (TextBox)a.FindControl("TextBoxControlContent"); string content = txt.Text.ToString(); if (content != "") { foreach (RepeaterItem s in RepeaterItem.Items) { TextBox txt1 = (TextBox)s.FindControl("TextBoxControlContent"); if (txt1.Text == "") { txt1.Text = content; } } } } }
protected void Filljhstate(object sender, EventArgs e) { RepeaterItem a = ((TextBox)sender).NamingContainer as RepeaterItem; string b = a.ItemIndex.ToString(); if (b == "0") { TextBox txt = (TextBox)a.FindControl("TextBoxState"); string jhstate = txt.Text.ToString(); if (jhstate != "") { foreach (RepeaterItem s in RepeaterItem.Items) { TextBox txt1 = (TextBox)s.FindControl("TextBoxState"); if (txt1.Text == "") { txt1.Text = jhstate; } } } } }
// ********************************************************************* // HandleDataBindingForTotalPosts // /// <summary> /// DataBinding event for the forum total posts /// </summary> /// // ********************************************************************/ private void HandleDataBindingForTotalPosts(Object sender, EventArgs e) { TableCell totalPosts = (TableCell)sender; RepeaterItem container = (RepeaterItem)totalPosts.NamingContainer; Label label; Forum forum = (Forum)container.DataItem; label = new Label(); label.CssClass = "normalTextSmaller"; if (forum.TotalPosts > 0) { label.Text = forum.TotalPosts.ToString("n0"); } else { label.Text = "-"; } totalPosts.Controls.Add(label); }
public void lbSelectDefineDetail_Click(object sender, EventArgs e) { LinkButton lbSelectDefineDetail = sender as LinkButton; RepeaterItem ri = (RepeaterItem)lbSelectDefineDetail.NamingContainer; string hfIDDefineDetailProduct = ((HiddenField)ri.FindControl("hfIDDefineDetailProduct")).Value; if (CheckIDInSelectedList(hfIDDefineDetailProduct)) { hfSelectedDefineDetail.Value = hfSelectedDefineDetail.Value.Replace(hfIDDefineDetailProduct + ",", ""); lbSelectDefineDetail.Text = "<i class='fa fa fa-square-o'></i>"; } else { hfSelectedDefineDetail.Value += hfIDDefineDetailProduct + ","; lbSelectDefineDetail.Text = "<i class='fa fa fa-check-square-o'></i>"; } if (lbSelectedDefineClick != null) { lbSelectedDefineClick(hfIDDefineDetailProduct, e); } }
protected void OnDelete(object sender, EventArgs e) {//Find the reference of the Repeater Item. RepeaterItem item = (sender as LinkButton).Parent as RepeaterItem; int BPCostingId = int.Parse((item.FindControl("lblBPCostingId") as Label).Text); string constr = ConfigurationManager.ConnectionStrings["conn"].ConnectionString; using (SqlConnection con = new SqlConnection(constr)) { using (SqlCommand cmd = new SqlCommand("BPCosting_CRUD")) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Action", "DELETE"); cmd.Parameters.AddWithValue("@BPCostingId", BPCostingId); cmd.Connection = con; con.Open(); cmd.ExecuteNonQuery(); con.Close(); } } this.BindRepeater(); }
protected void btnSubEliminarProblema_Click(object sender, EventArgs e) { divEditarInfo.Visible = false; int failedId = 7; int errorCode = -1; LinkButton button = (LinkButton)sender; RepeaterItem item = (RepeaterItem)button.NamingContainer; int rowTaskId = GetRowTaskId(item, failedId); if (rowTaskId != errorCode) { ProcessedTask processedTask = new ProcessedTask() { Id = rowTaskId }; processedTask.Read(); processedTask.IdTaskStatus = failedId; processedTask.Update(); } Response.Redirect("AdministrarTareaRechazada.aspx"); }
protected void repeatHotelTrans_ItemCommand(object source, RepeaterCommandEventArgs e) { RepeaterItem hotelTrans = e.Item; HiddenField getCode = (HiddenField)hotelTrans.FindControl("getCode"); Session["code"] = getCode.Value; int code = Convert.ToInt32(getCode.Value); Label getHotelStatus = (Label)hotelTrans.FindControl("hotelStatus"); Session["hotelStatus"] = getHotelStatus.Text; string hotelStatus = getHotelStatus.Text; Button getButton = (Button)hotelTrans.FindControl("getQRcode"); Session["getButton"] = getButton; if (hotelStatus == "Inactive" || hotelStatus.ToString() == "Verified") { Label2.Visible = true; Label2.Text = "This hotel reservation has been active or used"; Response.Redirect("hotelReservation.aspx"); } else { Response.Redirect("/HotelDetail.aspx?code=" + code); } //if (hotelStatus) //String redirectToQR; //redirectToQR = "<script> window.open('https://touristhelp20200209023102.azurewebsites.net/TicketDetail.aspx?code=" + code + "'); </script>"; //Response.Write(redirectToQR); }
/// <summary> /// This method fires when the user clicks the edit button for a news item /// and it allows the user to edit that news item. /// </summary> /// <param name="sender">The lbEditNewsItem LinkButton</param> /// <param name="e">The Click event</param> protected void lbEditNewsItem_Click(object sender, EventArgs e) { //Get the calling button LinkButton editButton = (LinkButton)sender; //Get the specific repeater item RepeaterItem item = (RepeaterItem)editButton.Parent; //Get the hidden field with the PK for editing HiddenField hfNewsItemPK = (HiddenField)item.FindControl("hfNewsItemPK"); //Get the PK from the hidden field int?itemPK = (String.IsNullOrWhiteSpace(hfNewsItemPK.Value) ? (int?)null : Convert.ToInt32(hfNewsItemPK.Value)); if (itemPK.HasValue) { using (PyramidContext context = new PyramidContext()) { //Get the note to edit NewsItem editNewsItem = context.NewsItem.AsNoTracking().Where(ni => ni.NewsItemPK == itemPK.Value).FirstOrDefault(); //Fill the inputs lblAddEditNewsItem.Text = "Edit News Item"; txtItemNum.Value = editNewsItem.ItemNum; txtNewsItemContents.Value = editNewsItem.Contents; hfAddEditNewsItemPK.Value = itemPK.Value.ToString(); } //Show the note div divAddEditNewsItem.Visible = true; //Set focus to the order number field txtItemNum.Focus(); } else { msgSys.ShowMessageToUser("danger", "Error", "An error occurred while attempting to load the selected note!", 20000); } }
protected void OnUpdate(object sender, EventArgs e) { RepeaterItem item = (sender as HtmlButton).Parent as RepeaterItem; int RoomID = int.Parse((item.FindControl("lblRoomID") as Label).Text); int RoomFloor = int.Parse((item.FindControl("txtRF") as TextBox).Text); string RoomNumber = (item.FindControl("txtRN") as TextBox).Text.Trim(); // string RoomPrice = (item.FindControl("txtRP") as TextBox).Text.Trim(); string RoomCapacity = (item.FindControl("txtRC") as TextBox).Text.Trim(); string RoomDescription = (item.FindControl("txtRD") as TextBox).Text.Trim(); int GuestHouseID = int.Parse((item.FindControl("ddlGH") as DropDownList).SelectedValue); int RoomTypeID = int.Parse((item.FindControl("ddlRT") as DropDownList).SelectedValue); int BookingStatusID = int.Parse((item.FindControl("ddlBS") as DropDownList).SelectedValue); string constr = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString; using (SqlConnection con = new SqlConnection(constr)) { using (SqlCommand cmd = new SqlCommand("spRoomDetailsCRUD")) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Action", "UPDATE"); cmd.Parameters.AddWithValue("@RoomID", RoomID); cmd.Parameters.AddWithValue("@RoomFloor", RoomFloor); cmd.Parameters.AddWithValue("@RoomNumber", RoomNumber); //cmd.Parameters.AddWithValue("@RoomPrice", RoomPrice); cmd.Parameters.AddWithValue("@RoomCapacity", RoomCapacity); cmd.Parameters.AddWithValue("@RoomDescription", RoomDescription); cmd.Parameters.AddWithValue("@GuestHouseID", GuestHouseID); cmd.Parameters.AddWithValue("@BookingStatusID", BookingStatusID); cmd.Parameters.AddWithValue("@RoomTypeID", RoomTypeID); cmd.Connection = con; con.Open(); cmd.ExecuteNonQuery(); con.Close(); } } this.BindRepeater(); }
protected void OnDeleteHorror(object sender, EventArgs e) { RepeaterItem item = (sender as LinkButton).Parent as RepeaterItem; int bookId = int.Parse((item.FindControl("lblAnimeId") as Label).Text); string constr = ConfigurationManager.ConnectionStrings["SunnyCS"].ConnectionString; using (SqlConnection con = new SqlConnection(constr)) { using (SqlCommand cmd = new SqlCommand("Horror_CRUD")) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Action", "DELETE"); cmd.Parameters.AddWithValue("@AnimeId", bookId); cmd.Connection = con; con.Open(); cmd.ExecuteNonQuery(); con.Close(); } } this.BindRepeater(); }
/// <summary> /// 获得选择框返回值 /// </summary> /// <returns></returns> string ReturnSelectedRowId() { string ids = null; for (int i = 0; i < Repeater1.Items.Count; i++) { RepeaterItem gvr = Repeater1.Items[i]; CheckBox cb = (CheckBox)gvr.FindControl("che"); if (cb.Checked) { if (ids != null && ids != "") { ids += "," + cb.ToolTip.ToString(); } else { ids = cb.ToolTip.ToString(); } } } return(ids); }
protected void OnUpdateHorror(object sender, EventArgs e) { //Find the reference of the Repeater Item. RepeaterItem item = (sender as LinkButton).Parent as RepeaterItem; //Finds the matching BS_ID in the row of data int bookId = int.Parse((item.FindControl("lblAnimeId") as Label).Text); //Trim() allows data to be modified string name = (item.FindControl("txtTitle") as TextBox).Text.Trim(); string price = (item.FindControl("txtStudio") as TextBox).Text.Trim(); string image = (item.FindControl("txtImage") as TextBox).Text.Trim(); string constr = ConfigurationManager.ConnectionStrings["SunnyCS"].ConnectionString; using (SqlConnection con = new SqlConnection(constr)) { //using stored procedure using (SqlCommand cmd = new SqlCommand("Horror_CRUD")) { cmd.CommandType = CommandType.StoredProcedure; //call the action UPDATE cmd.Parameters.AddWithValue("@Action", "UPDATE"); //pass in new values cmd.Parameters.AddWithValue("@AnimeId", bookId); cmd.Parameters.AddWithValue("@Title", name); cmd.Parameters.AddWithValue("@Studio", price); cmd.Parameters.AddWithValue("@Image", image); cmd.Connection = con; con.Open(); cmd.ExecuteNonQuery(); con.Close(); } Product aProd = new Product(); prod = aProd.getProduct(bookId.ToString()); prod.ProductUpdate(bookId, name, price, image); } //display this.BindRepeater(); }
protected void ibnEliminar_Click(object sender, ImageClickEventArgs e) { ImageButton ibn = (ImageButton)sender; RepeaterItem fila = (RepeaterItem)ibn.Parent; int _Comportamiento_id = int.Parse(((Label)fila.Controls[1]).Text); bool obeRespuesta = _COM_ComportamientoBL.EliminarCOM_Comportamiento(_Comportamiento_id); if (!obeRespuesta) { String mensaje = "<script language='JavaScript'>window.alert('error, no se pudo eliminar el registro')"; mensaje += Environment.NewLine; this.Page.Response.Write(mensaje); } else { String mensaje = "<script language='JavaScript'>window.alert('Registro eliminado')"; mensaje += Environment.NewLine; this.Page.Response.Write(mensaje); } GenerarTabla(((Fnc_FuncionariosBE)Session["FNC_Funcionarios"]).Funcionario_Id); }
protected void rptCarton_ItemDataBound(object sender, RepeaterItemEventArgs e) { RepeaterItem item = e.Item; if (item.ItemIndex > -1 && item.DataItem is PackingListBO) { PackingListBO objPacking = (PackingListBO)item.DataItem; Literal litCartonNo = (Literal)item.FindControl("litCartonNo"); litCartonNo.Text = "පෙට්ටිය " + objPacking.CartonNo.ToString() + "<br/>Carton " + objPacking.CartonNo.ToString(); HiddenField hdnCartonNo = (HiddenField)item.FindControl("hdnCartonNo"); hdnCartonNo.Value = objPacking.CartonNo.ToString(); Image imgCarton = (Image)item.FindControl("imgCarton"); imgCarton.Attributes.Add("cid", objPacking.CartonNo.ToString()); //HyperLink linkReset = (HyperLink)item.FindControl("linkReset"); //linkReset.Attributes.Add("cid", objPacking.CartonNo.ToString()); //linkReset.Attributes.Add("wid", objPacking.WeeklyProductionCapacity.ToString()); } }
protected void btn_insert_Click(object sender, EventArgs e) { int count = 0; DataTable dt = this.GetDataTable(); for (int i = 0; i < tbpc_otherpurbillRepeater.Items.Count; i++) { RepeaterItem Reitem = tbpc_otherpurbillRepeater.Items[i]; CheckBox chk = (CheckBox)Reitem.FindControl("CHK"); if (chk.Checked) { count++; } } if (count > 1) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('只能选择一行!');", true); } else if (count == 0) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('请选择要插入行的位置!');", true); } else if (count == 1) { for (int i = 0; i < tbpc_otherpurbillRepeater.Items.Count; i++) { RepeaterItem Reitem = tbpc_otherpurbillRepeater.Items[i]; CheckBox chk = (CheckBox)Reitem.FindControl("CHK"); if (chk.Checked) { DataRow newRow = dt.NewRow(); dt.Rows.InsertAt(newRow, i + 1); count++; } } } this.tbpc_otherpurbillRepeater.DataSource = dt; this.tbpc_otherpurbillRepeater.DataBind(); }
protected void btn_delectrow_Click(object sender, EventArgs e) { int count = 0; DataTable dt = this.GetDataTable(); for (int i = 0; i < SM_YULIAO_List_Repeater.Items.Count; i++) { RepeaterItem Reitem = SM_YULIAO_List_Repeater.Items[i]; CheckBox chk = (CheckBox)Reitem.FindControl("CHK"); if (chk.Checked) { dt.Rows.RemoveAt(i - count); count++; } } if (count == 0) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('请选择要删除的行!');", true); } this.SM_YULIAO_List_Repeater.DataSource = dt; this.SM_YULIAO_List_Repeater.DataBind(); }
protected void lnkDelete_Click(object sender, EventArgs e) { RepeaterItem item = (sender as LinkButton).Parent as RepeaterItem; Int32 GroupCount = int.Parse((item.FindControl("lblGroupCount") as Label).Text); spnMessage.Visible = true; Int32 GroupId = int.Parse((item.FindControl("lblGroupId") as Label).Text); bool yes = (new Cls_collectiontrip_b().Delete(GroupId)); if (yes) { BindGroup(); spnMessage.Style.Add("color", "green"); spnMessage.InnerText = "Trip Deleted Successfully"; } else { spnMessage.Style.Add("color", "red"); spnMessage.InnerText = "Trip Not Deleted"; } }
public void AcceptReject(string st, object sender1) { Button btn = (Button)sender1; RepeaterItem ri1 = (RepeaterItem)btn.Parent; int rdIndex = ri1.ItemIndex; string strQry = "Proc_RideSchedule"; SqlParameter[] sqp = new SqlParameter[3]; sqp[0] = new SqlParameter("@RideId", rd[rdIndex].RideId); sqp[1] = new SqlParameter("@DriverId", Convert.ToInt16(Session["UserId"].ToString())); sqp[2] = new SqlParameter("@Status", st); int i = 0; i = c.ExecuteProc(strQry, sqp); if (i > 0) { AddRidesRpt(); } }
protected void SetItemTimeline(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { // set field values SetFieldValues(sender, e); HiddenField itemTimeleinIdField = e.Item.FindControl("ItemTimelineId") as HiddenField; CheckBox cb = e.Item.FindControl("ItemTimelineCheckBox") as CheckBox; // locate foreign keys RepeaterItem schemaItemRow = e.Item.NamingContainer.NamingContainer as RepeaterItem; int timelineId = (int)DataBinder.Eval(e.Item.DataItem, Timeline.TimelineId); int schemaItemId = (int)DataBinder.Eval(schemaItemRow.DataItem, SchemaItem.SchemaItemId); int? itemTimelineId = GetItemTimelineId(timelineId, schemaItemId); // set pri key itemTimeleinIdField.Value = itemTimelineId + ""; // set current state cb.Checked = itemTimelineId.HasValue; } }
public void EditarCarrinho() { List <pCarrinho> Lp = Session["Carrinho"] as List <pCarrinho>; for (int i = 0; i < Lp.Count; i++) { for (int a = 0; a < rptProduto.Items.Count; a++) { RepeaterItem Rpt = (RepeaterItem)rptProduto.Items[i]; string lblCod_Pecas = (Rpt.FindControl("lblCod_Pecas") as Label).Text; if (Lp[i].Cod_Pecas.ToString() == lblCod_Pecas) { (Rpt.FindControl("ChkMais") as CheckBox).Checked = true; TextBox txtQuantidade = (TextBox)Rpt.FindControl("txtQuantidade"); txtQuantidade.Enabled = true; txtQuantidade.Text = Lp[i].pQuantidade.ToString(); (Rpt.FindControl("lblTotal") as Label).Text = Lp[i].Total.ToString(); } } } AtuTotais(); }
//protected void lnkNotActiveDelete_Click(object sender, EventArgs e) //{ // LinkButton lnkNotActiveDelete = (LinkButton)sender; // RepeaterItem item = (RepeaterItem)lnkNotActiveDelete.NamingContainer; // Int64 UserId = Convert.ToInt64(lnkNotActiveDelete.CommandArgument); // bool yes = User_Delete(UserId); // spnMessage.Visible = true; // if (yes) // { // SelectAllActiveUser(); // SelectAllNotActiveUser(); // spnMessage.Style.Add("color", "green"); // spnMessage.InnerText = "User Deleted Successfully"; // } // else // { // spnMessage.Style.Add("color", "green"); // spnMessage.InnerText = "User Not Deleted"; // } //} protected void lnkActiveUserDelete_Click(object sender, EventArgs e) { LinkButton lnkActiveUserDelete = (LinkButton)sender; RepeaterItem item = (RepeaterItem)lnkActiveUserDelete.NamingContainer; Int64 UserId = Convert.ToInt64(lnkActiveUserDelete.CommandArgument); bool yes = User_Delete(UserId); spnMessage.Visible = true; if (yes) { //SelectAllActiveUser(); //SelectAllNotActiveUser(); search(); spnMessage.Style.Add("color", "green"); spnMessage.InnerText = "User Deleted Successfully"; } else { spnMessage.Style.Add("color", "green"); spnMessage.InnerText = "User Not Deleted"; } }
private void ToggleElements(RepeaterItem item, bool isEdit) { //Toggle Buttons. item.FindControl("lnkEdit").Visible = !isEdit; item.FindControl("lnkUpdate").Visible = isEdit; item.FindControl("lnkCancel").Visible = isEdit; item.FindControl("lnkDelete").Visible = !isEdit; //Toggle Labels. item.FindControl("lblMovie_Name").Visible = !isEdit; item.FindControl("lblMovie_Category").Visible = !isEdit; item.FindControl("lblMovie_Description").Visible = !isEdit; item.FindControl("lblMovie_Year").Visible = !isEdit; item.FindControl("lblMovie_Price").Visible = !isEdit; //Toggle TextBoxes. item.FindControl("txtMovie_Name").Visible = isEdit; item.FindControl("txtMovie_Category").Visible = isEdit; item.FindControl("txtMovie_Description").Visible = isEdit; item.FindControl("txtMovie_Year").Visible = isEdit; item.FindControl("txtMovie_Price").Visible = isEdit; }
private void BindContent(RepeaterItem item) { Label lblStudentName = (Label)item.FindControl("lblStudentName"); lblStudentName.Text = studentList.Rows[item.ItemIndex]["FirstName"].ToString() + " " + studentList.Rows[item.ItemIndex]["LastName"].ToString(); Label lblCurrGrade = (Label)item.FindControl("lblCurrGrade"); lblCurrGrade.Text = "Grade " + portInfo.Rows[0]["GradeNumber"].ToString(); strSQL = " select a.PathwayName" + SuffixCode() + ",b.ClusteName" + NonEngSuffixCode() + ",b.ClusterCode,b.ClusterType from ClusterPathways a JOIN ClusterCodes b ON a.ClusterID = b.ClusterID JOIN ClusterInstructions c ON b.ClusterType = c.ClusterName where PathwayID='" + strPathwayID + "'; "; strSQL += " select DiplomaNameShort" + SuffixCode() + ",convert(decimal(5,1),TotalCredits) TotalCredits from ClusterPOSDiploma where DiplomaID = " + strDiploma + "; "; string portfolioID = studentList.Rows[item.ItemIndex]["PortfolioID"].ToString(); strSQL += " SELECT ui.InstitutionName FROM portfolio p inner join userinfo ui on p.schoolid = ui.schoolid "; strSQL += " WHERE p.portfolioID =" + portfolioID + ";"; dtTables = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTables(strSQL); dtCluster = dtTables[0]; dtDiploma = dtTables[1]; dtSchool = dtTables[2]; if (dtSchool.Rows.Count > 0) { Label lblSchool = (Label)item.FindControl("lblSchool"); lblSchool.Text = dtSchool.Rows[0]["InstitutionName"].ToString(); } if (dtCluster.Rows.Count > 0) { Label lblProgram = (Label)item.FindControl("lblProgram"); lblProgram.Text = dtCluster.Rows[0]["PathwayName" + SuffixCode()].ToString(); Label lblCluster = (Label)item.FindControl("lblCluster"); lblCluster.Text = dtCluster.Rows[0]["ClusteName" + NonEngSuffixCode()].ToString(); } if (dtDiploma.Rows.Count > 0) { Label lblDiploma = (Label)item.FindControl("lblDiploma"); lblDiploma.Text = dtDiploma.Rows[0]["DiplomaNameShort_EN"].ToString(); } }
/// <summary> /// Loads the external edit control and sets visibility of other controls /// </summary> /// <param name="repeaterItem">Repeater item</param> /// <param name="type">Source type</param> private void LoadExternalEditControl(RepeaterItem repeaterItem, FileTypeEnum type) { var plcAttachmentActions = repeaterItem.FindControl("plcAttachmentActions") as PlaceHolder; var plcAttachmentUpdtAction = repeaterItem.FindControl("plcAttachmentUpdtAction") as PlaceHolder; var plcLibraryUpdtAction = repeaterItem.FindControl("plcLibraryUpdtAction") as PlaceHolder; var plcExt = repeaterItem.FindControl("plcExtEdit") as PlaceHolder; var plcExtMfi = repeaterItem.FindControl("plcExtEditMfi") as PlaceHolder; var pnlDisabledUpdate = (repeaterItem.FindControl("pnlDisabledUpdate") as Panel); var dfuLib = repeaterItem.FindControl("dfuElemLib") as DirectFileUploader; var dfu = repeaterItem.FindControl("dfuElem") as DirectFileUploader; var btnEdit = repeaterItem.FindControl("btnEdit") as WebControl; var btnDelete = repeaterItem.FindControl("btnDelete") as WebControl; if ((plcAttachmentActions != null) && (plcLibraryUpdtAction != null) && (plcAttachmentUpdtAction != null) && (plcExt != null) && (plcExtMfi != null) && (pnlDisabledUpdate != null) && (dfuLib != null) && (dfu != null) && (btnEdit != null) && (btnDelete != null)) { var data = new DataRowContainer((DataRowView)repeaterItem.DataItem); plcAttachmentActions.Visible = true; plcAttachmentUpdtAction.Visible = false; pnlDisabledUpdate.Visible = false; dfuLib.Visible = false; dfu.Visible = false; btnEdit.Visible = false; btnDelete.Visible = false; plcExt.Visible = false; plcExtMfi.Visible = false; plcLibraryUpdtAction.Visible = (type == FileTypeEnum.MediaFile); ExternalEditHelper.LoadExternalEditControl(plcExt, type, null, data, IsLiveSite, TreeNodeObj, true); } }
// Constructors public RepeaterItemEventArgs(RepeaterItem item) { }
/// <summary> /// Sets visibility of WebDAV edit control. /// </summary> /// <param name="repeaterItem">Repeater item</param> /// <param name="controlType">Control type</param> private void VisibleWebDAVEditControl(RepeaterItem repeaterItem, WebDAVControlTypeEnum controlType) { PlaceHolder plcAttachmentActions = repeaterItem.FindControl("plcAttachmentActions") as PlaceHolder; PlaceHolder plcAttachmentUpdtAction = repeaterItem.FindControl("plcAttachmentUpdtAction") as PlaceHolder; PlaceHolder plcLibraryUpdtAction = repeaterItem.FindControl("plcLibraryUpdtAction") as PlaceHolder; PlaceHolder plcWebDAV = repeaterItem.FindControl("plcWebDAV") as PlaceHolder; PlaceHolder plcWebDAVMfi = repeaterItem.FindControl("plcWebDAVMfi") as PlaceHolder; Panel pnlDisabledUpdate = (repeaterItem.FindControl("pnlDisabledUpdate") as Panel); DirectFileUploader dfuLib = repeaterItem.FindControl("dfuElemLib") as DirectFileUploader; DirectFileUploader dfu = repeaterItem.FindControl("dfuElem") as DirectFileUploader; ImageButton btnEdit = repeaterItem.FindControl("btnEdit") as ImageButton; ImageButton btnDelete = repeaterItem.FindControl("btnDelete") as ImageButton; if ((plcAttachmentActions != null) && (plcLibraryUpdtAction != null) && (plcAttachmentUpdtAction != null) && (plcWebDAV != null) && (plcWebDAVMfi != null) && (pnlDisabledUpdate != null) && (dfuLib != null) && (dfu != null) && (btnEdit != null) && (btnDelete != null)) { WebDAVEditControl webDAVElem = null; if (controlType == WebDAVControlTypeEnum.Media) { plcAttachmentActions.Visible = true; plcAttachmentUpdtAction.Visible = false; plcLibraryUpdtAction.Visible = true; pnlDisabledUpdate.Visible = false; dfuLib.Visible = false; dfu.Visible = false; btnEdit.Visible = false; btnDelete.Visible = false; plcWebDAV.Visible = false; webDAVElem = Page.LoadUserControl("~/CMSModules/MediaLibrary/Controls/WebDAV/MediaFileWebDAVEditControl.ascx") as WebDAVEditControl; if (webDAVElem != null) { plcWebDAVMfi.Controls.Clear(); plcWebDAVMfi.Controls.Add(webDAVElem); } } else if (controlType == WebDAVControlTypeEnum.Attachment) { plcAttachmentActions.Visible = true; plcAttachmentUpdtAction.Visible = false; plcLibraryUpdtAction.Visible = false; pnlDisabledUpdate.Visible = false; dfuLib.Visible = false; dfu.Visible = false; btnEdit.Visible = false; btnDelete.Visible = false; plcWebDAV.Visible = true; // Dynamically load control webDAVElem = Page.LoadUserControl("~/CMSModules/WebDAV/Controls/AttachmentWebDAVEditControl.ascx") as WebDAVEditControl; if (webDAVElem != null) { plcWebDAV.Controls.Clear(); plcWebDAV.Controls.Add(webDAVElem); } } if (webDAVElem != null) { webDAVElem.Visible = false; webDAVElem.CssClass = null; IDataContainer data = new DataRowContainer((DataRowView)repeaterItem.DataItem); string extension = data.GetValue(FileExtensionColumn).ToString(); // If the WebDAV is enabled and windows authentication and extension is allowed if (CMSContext.IsWebDAVEnabled(CMSContext.CurrentSiteName) && RequestHelper.IsWindowsAuthentication() && WebDAVSettings.IsExtensionAllowedForEditMode(extension, CMSContext.CurrentSiteName)) { // Set WebDAV edit control GetWebDAVEditControl(ref webDAVElem, data); } } } }
private void ToggleElements(RepeaterItem item, bool isEdit) { //Toggle Buttons. item.FindControl("editLink").Visible = !isEdit; item.FindControl("updateLink").Visible = isEdit; item.FindControl("cancelLink").Visible = isEdit; //Toggle Labels. item.FindControl("nameLabel").Visible = !isEdit; //Toggle TextBoxes. item.FindControl("EditName").Visible = isEdit; if (LeadershipDisplay.Items.FindByValue("Scholarships").Selected == true) { item.FindControl("sortLabel").Visible = !isEdit; item.FindControl("EditSort").Visible = isEdit; item.FindControl("establishedLabel").Visible = !isEdit; item.FindControl("EditEstablished").Visible = isEdit; } else if (LeadershipDisplay.Items.FindByValue("Founders").Selected == true) { item.FindControl("statusLabel").Visible = !isEdit; item.FindControl("EditStatus").Visible = isEdit; } }
private void ToggleElements(RepeaterItem item, bool isEdit) { //Toggle Buttons. item.FindControl("editLink").Visible = !isEdit; item.FindControl("updateLink").Visible = isEdit; item.FindControl("cancelLink").Visible = isEdit; //Toggle Labels. item.FindControl("photoLabel").Visible = !isEdit; item.FindControl("nameLabel").Visible = !isEdit; item.FindControl("profileLabel").Visible = !isEdit; //Toggle TextBoxes. item.FindControl("EditPhoto").Visible = isEdit; item.FindControl("EditName").Visible = isEdit; item.FindControl("EditProfile").Visible = isEdit; }
void appendChild(string rid, string pid, RepeaterItem pcontrols) { ArrayList pcheck = new ArrayList(); purviewEntity[] childmenu = purviewBll.getChildida(pid); pcheck = purviewBll.getChildid(rid, pid); CheckBoxList chbl = (CheckBoxList)pcontrols.FindControl("chkchilds"); chbl.DataSource = childmenu; chbl.DataTextField = "Menuname"; chbl.DataValueField = "id"; chbl.DataBind(); for (int i = 0; i < childmenu.Length; i++) { chbl.Items[i].Selected = pcheck.Contains(childmenu[i].Id); } }
/// <summary> /// BindData /// </summary> private void BindData(ITemplate template, DataRowView dr) { RepeaterItem item = new RepeaterItem(controlTemplateIndex, ListItemType.Item); item.DataItem = dr; item.ID = "ctl" + controlTemplateIndex.ToString().PadLeft(2, '0'); Controls.Add(item); template.InstantiateIn(item); item.DataBind(); controlTemplateIndex++; }
private void GetWidgetXml(string FolderName, RepeaterItem RPI) { try { DataSet DS = new DataSet(); DS.ReadXml(Server.MapPath(string.Format("~/Widgets/{0}/Widget.xml", FolderName))); foreach (DataRow dRow in DS.Tables[0].Rows) { for (int i = 0; i < dRow.ItemArray.Length; i++) { string property = DS.Tables[0].Columns[i].ColumnName; Literal LC = (Literal)RPI.FindControl(property); if (LC != null) { LC.Text = dRow[i].ToString(); } } } } catch (Exception ex) { MessageBox1.Message = ex.Message; MessageBox1.Type = MessageBox.ShowType.Error; } }
private void SetEditForm(RepeaterItem item, bool isEdit) { TextBox tbEditTitle = item.FindControl("tbEditTitle") as TextBox; TextBox tbEditDesc = item.FindControl("tbEditDesc") as TextBox; TextBox tbOrder = item.FindControl("tbOrder") as TextBox; Label lblTitle = item.FindControl("lblTitle") as Label; Label lblDesc = item.FindControl("lblDesc") as Label; Label lblOrder = item.FindControl("lblOrder") as Label; LinkButton lbEdit = item.FindControl("lbEdit") as LinkButton; LinkButton lbSave = item.FindControl("lbSave") as LinkButton; LinkButton lbDelete = item.FindControl("lbDelete") as LinkButton; LinkButton lbCancel = item.FindControl("lbCancel") as LinkButton; CheckBox cbActive = item.FindControl("cbActive") as CheckBox; tbEditTitle.Visible = tbEditDesc.Visible = tbOrder.Visible = lbSave.Visible = lbCancel.Visible = isEdit; lblTitle.Visible = lblDesc.Visible = lblOrder.Visible = lbEdit.Visible = lbDelete.Visible = !isEdit; cbActive.Enabled = isEdit; UpdatePanel upPan = item.FindControl("UpdatePanel1") as UpdatePanel; upPan.Update(); }
void RemoveCart(int id, RepeaterItem item) { dsCart.CartRow drCart = da.Cart_GetDataByID(id); if (drCart != null) { da.CartOptionalItem_DeleteByCartID(drCart.ID); drCart.Delete(); da.Cart_Update(drCart); MasterBase.Message = WebLib.DeletedSuccessfullyMessage; } }
void UpdateCart(int id, RepeaterItem item, CartType mode) { dsCart.CartRow drCart = da.Cart_GetDataByID(id); if (drCart != null) { #region Optional Items // Only applicable to machine if (mode == CartType.Machine) { Repeater repOptional = (Repeater)item.FindControl("repOptional"); foreach (RepeaterItem itemOptional in repOptional.Items) { HiddenField hidOptionalItemID = (HiddenField)itemOptional.FindControl("hidOptionalItemID"); TextBox txtOptionalQuantity = (TextBox)itemOptional.FindControl("txtOptionalQuantity"); dsCartOptionalItem.CartOptionalItemRow cartOptionalRow = da.CartOptionalItem_Get(int.Parse(hidOptionalItemID.Value)); if (Common.IsNum(txtOptionalQuantity.Text) && int.Parse(txtOptionalQuantity.Text) <= 9999) cartOptionalRow.Quantity = int.Parse(txtOptionalQuantity.Text); else cartOptionalRow.Quantity = 1; // Remove Item if (cartOptionalRow.Quantity == 0) cartOptionalRow.Delete(); da.CartOptionalItem_Update(cartOptionalRow); } } #endregion TextBox txtQuantity = (TextBox)item.FindControl("txtQuantity"); if (Common.IsNum(txtQuantity.Text) && int.Parse(txtQuantity.Text) <= 9999) drCart.Quantity = int.Parse(txtQuantity.Text); else drCart.Quantity = 1; // Remove Item if (drCart.Quantity == 0) drCart.Delete(); da.Cart_Update(drCart); MasterBase.Message = WebLib.UpdatedSuccessfullyMessage; } }
private ProductMachineItem prepareCartRecord(RepeaterItem item) { LinkButton lnkDetails = (LinkButton)item.FindControl("lnkDetails"); //Product ID int productID = int.Parse(lnkDetails.CommandArgument); TextBox txtQuantity = (TextBox)item.FindControl("txtQuantity"); Label lblPrice = (Label)item.FindControl("lblPrice"); TextBox txtPrice = (TextBox)item.FindControl("txtPrice"); RadioButtonList rdOrderType = (RadioButtonList)item.FindControl("rdOrderType"); dsCart _dsCart = new dsCart(); dsCart.CartRow drCart = _dsCart.Cart.CreateNewRow(); drCart.DealerUserID = WebLib.LoggedInUser.DealerUserID; drCart.CartItemID = productID; drCart.ItemTypeEnum = (int)ItemType.Machine; if (rdOrderType.SelectedValue == "Others") { drCart.OrderTypeEnum = (int)OrderType.Others; if (Common.IsNum(txtPrice.Text)) drCart.UnitPrice = decimal.Parse(txtPrice.Text); else drCart.UnitPrice = 0; } else { drCart.OrderTypeEnum = (int)OrderType.Normal; string[] price = lblPrice.Text.Split(' '); drCart.UnitPrice = decimal.Parse(price[0]); } drCart.IsPromotion = (rdIsPromotion.SelectedValue == "1" ? true : false); drCart.IsProduct = true; drCart.IsNewProduct = hidRdRecon.Value == "1" ? false : true; if (Common.IsNum(txtQuantity.Text) && int.Parse(txtQuantity.Text) <= 9999) drCart.Quantity = int.Parse(txtQuantity.Text); else drCart.Quantity = 1; drCart.CreatedBy = WebLib.LoggedInUser.DealerUserName; drCart.CreatedDate = DateTime.Now; drCart.ModifiedBy = WebLib.LoggedInUser.DealerUserName; drCart.ModifiedDate = DateTime.Now; ProductMachineItem productMachineItem = new ProductMachineItem(); productMachineItem.dataRowCart = drCart; productMachineItem.dataSetCart = _dsCart; productMachineItem.productID = productID; return productMachineItem; }
private void FillMessageInfo(RepeaterItem item, LinkButton btnUserName) { if (btnUserName != null) { PersonalInfo person = PersonalInfoRepository.GetUserInfo(Guid.Parse(btnUserName.Text)); btnUserName.Text = String.Join(" ", person.FirstName, person.LastName); } }
public RepeaterItemEventArgs (RepeaterItem item) { this.item = item; }
private void ToggleElements(RepeaterItem item, bool isEdit) { //Toggle Buttons. item.FindControl("editLink").Visible = !isEdit; item.FindControl("updateLink").Visible = isEdit; item.FindControl("cancelLink").Visible = isEdit; //Toggle Labels. item.FindControl("nameLabel").Visible = !isEdit; //Toggle TextBoxes. item.FindControl("EditName").Visible = isEdit; if (LeadershipDisplay.Items.FindByValue("AdvBoard").Selected == true) { item.FindControl("statusLabel").Visible = !isEdit; item.FindControl("EditStatus").Visible = isEdit; } else if (LeadershipDisplay.Items.FindByValue("ElecBoard").Selected == true) { item.FindControl("yearLabel").Visible = !isEdit; item.FindControl("EditYear").Visible = isEdit; } }
// Constructors public RepeaterCommandEventArgs(RepeaterItem item, object commandSource, CommandEventArgs originalArgs) { }
private void SetRewardDetailsForInsertUpdate(RepeaterItem Item) { Repeater Repeater2 = (Repeater)Item.FindControl("repTab_content"); #region get reward what details int col = 1; foreach (Control rptItem in Repeater2.Controls) { TextBox txtQty = (TextBox)rptItem.FindControl("txtRewards"); decimal val = 0; if (txtQty != null) { if (txtQty.Text != "") { val = Convert.ToDecimal(txtQty.Text); } } switch (col) { case 1: cmd_across.Parameters.AddWithValue("@reward_user", val); break; case 2: cmd_across.Parameters.AddWithValue("@reward_per_friend", val); break; case 3: cmd_across.Parameters.AddWithValue("@reward_per_like", val); break; case 4: cmd_across.Parameters.AddWithValue("@reward_per_share", val); break; } col++; } #endregion }
private void BindContent(RepeaterItem rptMassPrintPLPItem) { strSQL = " select a.PathwayName" + CareerCruisingWeb.CCLib.Common.Strings.SuffixCode() + ",b.ClusteName" + CareerCruisingWeb.CCLib.Common.Strings.NonEngSuffixCode() + ",b.ClusterCode,b.ClusterType from ClusterPathways a JOIN ClusterCodes b ON a.ClusterID = b.ClusterID JOIN ClusterInstructions c ON b.ClusterType = c.ClusterName where PathwayID='" + strPathwayID + "'; "; strSQL += " select DiplomaNameShort" + CareerCruisingWeb.CCLib.Common.Strings.SuffixCode() + ",convert(decimal(5,1),TotalCredits) TotalCredits from ClusterPOSDiploma where DiplomaID = " + strDiplomaID + "; "; string portfolioID = studentList.Rows[rptMassPrintPLPItem.ItemIndex]["PortfolioID"].ToString(); strSQL += " SELECT ui.InstitutionName FROM portfolio p inner join userinfo ui on p.schoolid = ui.schoolid "; strSQL += " WHERE p.portfolioID =" + portfolioID + ";"; dtTables = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTables(strSQL); dtCluster = dtTables[0]; dtDiploma = dtTables[1]; dtSchool = dtTables[2]; if (dtSchool.Rows.Count > 0) { Label lblSchool = (Label)rptMassPrintPLPItem.FindControl("lblSchool"); lblSchool.Text = dtSchool.Rows[0]["InstitutionName"].ToString(); } if (dtCluster.Rows.Count > 0) { Label lblProgram = (Label)rptMassPrintPLPItem.FindControl("lblProgram"); lblProgram.Text = dtCluster.Rows[0]["PathwayName" + CareerCruisingWeb.CCLib.Common.Strings.SuffixCode()].ToString(); Label lblCluster = (Label)rptMassPrintPLPItem.FindControl("lblCluster"); lblCluster.Text = dtCluster.Rows[0]["ClusteName" + CareerCruisingWeb.CCLib.Common.Strings.NonEngSuffixCode()].ToString(); strCluster = dtCluster.Rows[0]["ClusterCode"].ToString(); strType = dtCluster.Rows[0]["ClusterType"].ToString(); } if (dtDiploma.Rows.Count > 0) { Label lblDiploma = (Label)rptMassPrintPLPItem.FindControl("lblDiploma"); lblDiploma.Text = dtDiploma.Rows[0]["DiplomaNameShort_EN"].ToString(); } strSQL = " With CTE as ( "; strSQL += " SELECT POSSubjectID as Details, [9] as 'Grade 9',[10] as 'Grade 10',[11] as 'Grade 11',[12] as 'Grade 12' "; strSQL += " FROM (SELECT POSGridID,POSGrade,PosSubjectID FROM ClusterPOSGrid a join ClusterPOSSubjects b on a.PosSubjectID=b.PathwaySubjectID where b.ClusterName='" + strType + "') AS SourceTable "; strSQL += " PIVOT(max(POSGridID)FOR POSGrade IN ([9], [10], [11], [12])) AS PivotTable) "; strSQL += " select c.*,a.IsProgramOfStudy,a.PathwaySubjectName" + CareerCruisingWeb.CCLib.Common.Strings.SuffixCode() + ",a.Type,b.DetailDescr" + CareerCruisingWeb.CCLib.Common.Strings.SuffixCode() + ",case when isnull(b.credits,0)=0 then ' ' else 'Required: '+ convert(varchar(10),convert(decimal(5,1),b.Credits)) end Credits from CTE as c join ClusterPOSSubjects a on c.Details= a.PathwaySubjectID left join ClusterPOSDiplomaReq b on a.PathwaySubjectID = b.PathwaySubjectID where a.ClusterName='" + strType + "' and isnull(b.DiplomaID," + strDiplomaID + ")=" + strDiplomaID; strSQL += " order by Details "; dtSubject = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTable(strSQL); Repeater repeater = (Repeater)rptMassPrintPLPItem.FindControl("lstHS"); repeater.DataSource = dtSubject; repeater.DataBind(); }
private void ToggleElements(RepeaterItem item, bool isEdit) { //Toggle Buttons. item.FindControl("editLink").Visible = !isEdit; item.FindControl("updateLink").Visible = isEdit; item.FindControl("cancelLink").Visible = isEdit; if (LeadershipDisplay.Items.FindByValue("OutdoorsInfo").Selected == true) { item.FindControl("locationLabel").Visible = !isEdit; item.FindControl("EditLocation").Visible = isEdit; item.FindControl("nameLabel").Visible = !isEdit; item.FindControl("EditName").Visible = isEdit; item.FindControl("areaLabel").Visible = !isEdit; item.FindControl("EditArea").Visible = isEdit; item.FindControl("plaqueLabel").Visible = !isEdit; item.FindControl("EditPlaque").Visible = isEdit; item.FindControl("dedicationLabel").Visible = !isEdit; item.FindControl("EditDedication").Visible = isEdit; } else if (LeadershipDisplay.Items.FindByValue("ChapelInfo").Selected == true) { item.FindControl("levelLabel").Visible = !isEdit; item.FindControl("EditLevel").Visible = isEdit; item.FindControl("plaqueLabel").Visible = !isEdit; item.FindControl("EditPlaque").Visible = isEdit; item.FindControl("sortLabel").Visible = !isEdit; item.FindControl("EditSort").Visible = isEdit; item.FindControl("orderLabel").Visible = !isEdit; item.FindControl("EditOrder").Visible = isEdit; } else if (LeadershipDisplay.Items.FindByValue("ChapelInfo").Selected != true && LeadershipDisplay.Items.FindByValue("OutdoorsInfo").Selected != true) { item.FindControl("roomidLabel").Visible = !isEdit; item.FindControl("EditRoomId").Visible = isEdit; item.FindControl("nameLabel").Visible = !isEdit; item.FindControl("EditName").Visible = isEdit; item.FindControl("plaqueLabel").Visible = !isEdit; item.FindControl("EditPlaque").Visible = isEdit; item.FindControl("DateLabel").Visible = !isEdit; item.FindControl("EditDate").Visible = isEdit; } }