protected void Wall_ItemUpdating(object sender, ListViewUpdateEventArgs e) { LoginLib login = new LoginLib(); int LoginID = login.GetUserID(); GaymerLINQDataContext db = new GaymerLINQDataContext(); var comment = db.Comments.Where(a => a.CommentId == (int)Wall.DataKeys[e.ItemIndex].Value).First(); if (comment.AuthorID == LoginID) { ListViewItem item = Wall.Items[e.ItemIndex]; string UpdateContent = ((TextBox)item.FindControl("EditBox")).Text.ToString(); Wall.EditIndex = -1; var update = db.Comments.Where(a => a.CommentId == (int)Wall.DataKeys[e.ItemIndex].Value).First(); update.Text = UpdateContent; update.UpdateTime = DateTime.Now; try { db.SubmitChanges(); } catch { } var WallContent = from a in db.Comments where a.UserWallID != null ? a.UserWallID == GetActiveWall() : a.AuthorID == GetActiveWall() && !a.Hidden orderby a.CommentId descending select new { CommentID = a.CommentId, Username = a.User.Username, CreatedTime = a.CommentId == (int)Wall.DataKeys[e.ItemIndex].Value ? CreatedTime(DateTime.Now, a.CreateTime) : CreatedTime(a.UpdateTime, a.CreateTime), Comment = a.CommentId == (int)Wall.DataKeys[e.ItemIndex].Value ? UpdateContent : a.Text, EditBtnVisible = a.AuthorID == LoginID ? "display:inline;" : "display:none;", DeleteBtnVisible = a.AuthorID == LoginID ? "display:inline;" : a.UserWallID == LoginID ? "display:inline;" : "display:none;" }; Wall.DataSource = WallContent; Wall.DataBind(); } }
protected void ListView1_ItemUpdating(object sender, ListViewUpdateEventArgs e) { if (!string.IsNullOrEmpty(((TextBox)ListView1.EditItem.FindControl("TextBox1NewPass")).Text)) { e.NewValues["Password"] = ((TextBox)ListView1.EditItem.FindControl("TextBox1NewPass")).Text; } }
protected void lvCities_ItemUpdating(object sender, ListViewUpdateEventArgs e) { using (DBDataContext db = new DBDataContext()) { string name = ""; int ID = 0, DeliveryPrice = 0, FreeDelivery = 0; foreach (string key in e.NewValues.Keys) { switch(key) { case "Name": name = e.NewValues[key].ToString(); break; case "DeliveryPrice": int.TryParse(e.NewValues[key].ToString(), out DeliveryPrice); break; case "FreeDelivery": int.TryParse(e.NewValues[key].ToString(), out FreeDelivery); break; case "ID": int.TryParse(e.NewValues[key].ToString(), out ID); break; } } City c = db.Cities.First(C => C.ID == ID); c.Name = name; c.FreeDelivery = FreeDelivery; c.DeliveryPrice = DeliveryPrice; db.SubmitChanges(); } lvCities.EditIndex = -1; }
protected void lvRateExchange_ItemUpdating(object sender, ListViewUpdateEventArgs e) { ExchangeRatesRepository facade = new ExchangeRatesRepository(); StoreProRepository storeFacade = new StoreProRepository(); TextBox tbcurrency = (lvRateExchange.EditItem.FindControl("tbCurrency")) as TextBox; RadNumericTextBox rnbVNDRate = (lvRateExchange.EditItem.FindControl("rnbVNDRate")) as RadNumericTextBox; Label lbl = (lvRateExchange.Items[e.ItemIndex].FindControl("lbID")) as Label; String ids = ""; if (lbl != null) ids = lbl.Text; B_ExchangeRates exchangeRate = new B_ExchangeRates(); exchangeRate.Rate = (decimal)rnbVNDRate.Value; exchangeRate.Currency = tbcurrency.Text; exchangeRate.Id = Int32.Parse(ids); B_ExchangeRates exits = facade.GetById(exchangeRate.Id); if (exits != null) { storeFacade.StoreProcessor().B_ExchangeRate_history_process(exchangeRate.Currency, exchangeRate.Rate, this.UserId, 2); facade.Update(facade.GetById(exchangeRate.Id), exchangeRate); facade.Commit(); } lvRateExchange.EditIndex = -1; LoadDataTolvRateExchange(); }
protected void lvLoanInterestedRate_ItemUpdating(object sender, ListViewUpdateEventArgs e) { NewLoanInterestedKeyRepository facade = new NewLoanInterestedKeyRepository(); StoreProRepository storeFacade = new StoreProRepository(); RadNumericTextBox monthRate = (lvLoanInterestedRate.EditItem.FindControl("radMonthRate")) as RadNumericTextBox; TextBox rateDisplay = (lvLoanInterestedRate.EditItem.FindControl("tbRateDisplay")) as TextBox; RadNumericTextBox rnbVNDRate = (lvLoanInterestedRate.EditItem.FindControl("rnbVNDRate")) as RadNumericTextBox; RadNumericTextBox rnbUSDRate = (lvLoanInterestedRate.EditItem.FindControl("rnbUSDRate")) as RadNumericTextBox; Label lbl = (lvLoanInterestedRate.Items[e.ItemIndex].FindControl("lbID")) as Label; String ids = ""; if (lbl != null) ids = lbl.Text; BLOANINTEREST_KEY intKey = new BLOANINTEREST_KEY(); intKey.MonthLoanRateNo = (Int16)monthRate.Value; intKey.USD_InterestRate = (decimal)rnbUSDRate.Value; intKey.VND_InterestRate = (decimal)rnbVNDRate.Value; intKey.LoanInterest_Key = rateDisplay.Text; intKey.Id = Int32.Parse(ids); BLOANINTEREST_KEY exits = facade.GetById(intKey.Id); if (exits != null) { storeFacade.StoreProcessor().B_LoanInterested_Key_history_process(intKey.MonthLoanRateNo, intKey.VND_InterestRate, intKey.USD_InterestRate, this.UserId, 2); facade.Update(facade.GetById(intKey.Id), intKey); facade.Commit(); } lvLoanInterestedRate.EditIndex = -1; LoadDataTolvLoanInterestedRate(); }
/// <summary> /// Userses the view item updating. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e"> /// The <see cref="System.Web.UI.WebControls.ListViewUpdateEventArgs"/> /// instance containing the event data.</param> protected void UsersViewItemUpdating(object sender, ListViewUpdateEventArgs e) { var value = (DropDownList)usersView.EditItem.FindControl("Roles"); e.NewValues.Add("Privilegy", value.Text); if (e.OldValues["Login"].ToString()!=e.NewValues["Login"].ToString()&& ClientService.IsExist(e.NewValues["Login"].ToString())) e.Cancel = true; }
protected void ListView1_ItemUpdating(object sender, ListViewUpdateEventArgs e) { DropDownList NameDropDownList = (DropDownList)((ListView)sender).Items[e.ItemIndex].FindControl("dropdownlist1"); if (NameDropDownList != null) { SqlDataSource1.UpdateParameters["IdStatusu"].DefaultValue = NameDropDownList.SelectedValue; } }
protected void on_item_updating(object sender, ListViewUpdateEventArgs e) { var fupload = (FileUpload)lvModify.EditItem.FindControl("fupload"); if (fupload.HasFile) { fupload.SaveAs(@"C:\HostingSpaces\jwaldron\lasubu.com\wwwroot\Images\store\" + DateTime.Now.ToString("yyyyMMddHHmmss") + fupload.FileName); var imageUrl = "Images\\store\\" + DateTime.Now.ToString("yyyyMMddHHmmss") + fupload.FileName; e.NewValues["ImageURL"] = imageUrl; } }
protected void ListView1_ItemUpdating(object sender, ListViewUpdateEventArgs e) { DropDownList ddl = ListView1.EditItem.FindControl("DropDownList1") as DropDownList; if (ddl != null) e.NewValues["stanowisko_id"] = ddl.SelectedValue; // Dział DropDownList ddl2 = ListView1.EditItem.FindControl("DropDownList2") as DropDownList; if (ddl2 != null) e.NewValues["dzial_id"] = ddl2.SelectedValue; }
protected void BaanOEMList_ItemUpdating(object sender, ListViewUpdateEventArgs e) { ListViewItem itm = BaanOEMList.Items[e.ItemIndex]; string gn = ((TextBox)itm.FindControl("groupName")).Text.Trim(); int id = Convert.ToInt32(((Label)itm.FindControl("BaanOEMId")).Text); OEMBaan oem = new OEMBaan(id); oem.GroupName = gn; oem.update(); BaanOEMList.EditIndex = -1; loadData(); }
protected void lvCustomers_ItemUpdating(object sender, ListViewUpdateEventArgs e) { try { // retrieve the row being updated // lvCustomer.EditIndex = e.NewEditIndex from edit call ListViewItem item = lvCustomers.Items[lvCustomers.EditIndex]; // // Retrieve the DropDownList control from the row. //DropDownList list = (DropDownList)item.FindControl("TitlesList"); //// Add the selected value of the DropDownList control to //// the NewValues collection. The NewValues collection is //// passed to the data source control, which then updates the //// data source. //e.NewValues["Title"] = list.SelectedValue; DataKey currentDataKey = lvCustomers.DataKeys[lvCustomers.EditIndex]; //lblTest.Text = (currentDataKey["AccountID"]).ToString(); int accountID = Int32.Parse((currentDataKey["AccountID"]).ToString()); string company = ((TextBox)item.FindControl("txtCompany")).Text; string firstN = ((TextBox)item.FindControl("txtLastname")).Text; string lastN = ((TextBox)item.FindControl("txtFirstname")).Text; //int acctTypeID = Int32.Parse( (( DropDownList)item.FindControl("ddlAccountTypeID")).SelectedValue ); int acctTypeID = FindType(((TextBox)item.FindControl("txtAccountType")).Text); string contName = ((TextBox)item.FindControl("txtContactName")).Text; string phone = ((TextBox)item.FindControl("txtPhone")).Text; string fax = ((TextBox)item.FindControl("txtFax")).Text; string email = ((TextBox)item.FindControl("txtEmail")).Text; //int contTypeID = Int32.Parse(((DropDownList)item.FindControl("ddConacttTypeID")).SelectedValue); int contTypeID = FindType(((TextBox)item.FindControl("txtContactType")).Text); string address1 = ((TextBox)item.FindControl("txtAddress1")).Text; string address2 = ((TextBox)item.FindControl("txtAddress2")).Text; string postCode = ((TextBox)item.FindControl("txtPostalCode")).Text; string city = ((TextBox)item.FindControl("txtCity")).Text; string state = ((TextBox)item.FindControl("txtState")).Text; string country = ((TextBox)item.FindControl("txtCountry")).Text; //int addTypeID = Int32.Parse( ((DropDownList)item.FindControl("ddlAddTypeID")).Text); int addTypeID = FindType(((TextBox)item.FindControl("txtAddType")).Text); bool success = AccountAccess.Account_Update( accountID, company, firstN, lastN, acctTypeID, address1, address2, city, state, country, postCode, addTypeID, contName, phone, fax, email, contTypeID ); lvCustomers.EditIndex = -1; lblTest.Text = success ? "Update Succeed" : "Update Failed"; } catch { lblTest.Text = "Update Failed"; } BindListView(); }
protected void lvEmployee_ItemUpdating(object sender, ListViewUpdateEventArgs e) { try { // retrieve the row being updated // lvCustomer.EditIndex = e.NewEditIndex from edit call ListViewItem item = lvEmployee.Items[lvEmployee.EditIndex]; DataKey currentDataKey = lvEmployee.DataKeys[lvEmployee.EditIndex]; // lblTest.Text = (currentDataKey["EmployeeID"]).ToString(); int employeeID = Int32.Parse((currentDataKey["EmployeeID"]).ToString()); string userID = ((TextBox)item.FindControl("txtUserID")).Text; string password = ((TextBox)item.FindControl("txtPassword")).Text; string title = ((TextBox)item.FindControl("txtTitle")).Text; string firstName = ((TextBox)item.FindControl("txtFirstname")).Text; string lastName = ((TextBox)item.FindControl("txtLastname")).Text; int typeID = FindType(((TextBox)item.FindControl("txtEmployeeType")).Text); //int EmpTypeID = Int32.Parse(((DropDownList)item.FindControl("TypeID")).SelectedValue); string address1 = ((TextBox)item.FindControl("txtAddress1")).Text; string address2 = ((TextBox)item.FindControl("txtAddress2")).Text; string city = ((TextBox)item.FindControl("txtCity")).Text; string state = ((TextBox)item.FindControl("txtState")).Text; string postCode = ((TextBox)item.FindControl("txtPostalCode")).Text; string country = ((TextBox)item.FindControl("txtCountry")).Text; int addTypeID = FindType(((TextBox)item.FindControl("txtAddType")).Text); //int addTypeID = Int32.Parse( ((DropDownList)item.FindControl("ddlAddTypeID")).Text); string contName = ((TextBox)item.FindControl("txtContactName")).Text; string phone = ((TextBox)item.FindControl("txtPhone")).Text; string fax = ((TextBox)item.FindControl("txtFax")).Text; string email = ((TextBox)item.FindControl("txtEmail")).Text; //int contTypeID = Int32.Parse(((DropDownList)item.FindControl("ddConacttTypeID")).SelectedValue); int contTypeID = FindType(((TextBox)item.FindControl("txtContactType")).Text); bool success = EmployeeAccess.Employee_Update(employeeID, userID, password, firstName, lastName, title, typeID , address1, address2, city, state, postCode, country, addTypeID , contName, phone, fax, email, contTypeID); lvEmployee.EditIndex = -1; lblTest.Text = success ? "Update Succeed" : "Update Failed"; } catch { lblTest.Text = e.ToString(); // "Update Failed"; } BindListView(); }
protected void Appointments_ItemUpdating(object sender, ListViewUpdateEventArgs e) { ListViewItem item = ListView1.Items[ListView1.EditIndex]; Appointment editing = new Appointment(); Label IdLbl = (Label)item.FindControl("IdLabel1"); String Id = IdLbl.Text; TextBox UserNameLbl = (TextBox)item.FindControl("UserNameTextBox"); String UserName = UserNameLbl.Text; TextBox UserEmailAddressLbl = (TextBox)item.FindControl("UserEmailAddressTextBox"); String UserEmailAddress = UserEmailAddressLbl.Text; TextBox StartDateLbl = (TextBox)item.FindControl("StartDateTextBox"); DateTime StartDate = DateTime.Parse(StartDateLbl.Text); TextBox EndDateLbl = (TextBox)item.FindControl("EndDateTextBox"); DateTime EndDate = DateTime.Parse(EndDateLbl.Text); TextBox CommentsLbl = ListView1.Items[ListView1.EditIndex].FindControl("CommentsTextBox") as TextBox; String Comments = CommentsLbl.Text; TextBox BookingObjectIdLbl = (TextBox)item.FindControl("BookingObjectIdTextBox"); String BookingObjectId = BookingObjectIdLbl.Text; SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ABSConnectionString"].ToString()); SqlCommand cmd = new SqlCommand("dbo.UpdateAppointment", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Id", Id); cmd.Parameters.AddWithValue("@UserName", UserName); cmd.Parameters.AddWithValue("@UserEmailAddress", UserEmailAddress); cmd.Parameters.AddWithValue("@StartDate", StartDate.ToString("yyyy-MM-dd HH:mm:ss")); cmd.Parameters.AddWithValue("@EndDate", EndDate.ToString("yyyy-MM-dd HH:mm:ss")); cmd.Parameters.AddWithValue("@Comments", Comments); cmd.Parameters.AddWithValue("@BookingObjectId", BookingObjectId); conn.Open(); Int32 rowsAffected; rowsAffected = cmd.ExecuteNonQuery(); conn.Close(); ListView1.EditIndex = -1; ListView1.DataSource = Appointments; ListView1.DataBind(); }
protected void ListView1_ItemUpdating(object sender, ListViewUpdateEventArgs e) { string id = ListView1.DataKeys[e.ItemIndex].Value.ToString(); TextBox tbType = ListView1.EditItem.FindControl("tbType") as TextBox; TextBox tbPrice = ListView1.EditItem.FindControl("tbPrice") as TextBox; TextBox tbNumber = ListView1.EditItem.FindControl("tbNumber") as TextBox; try { BLL.Application.GZL.CG.PurchaseFormEdit.updatePurchaseFormItems(Convert.ToInt32(id), tbType.Text, float.Parse(tbPrice.Text), Convert.ToInt32(tbNumber.Text)); } catch (Exception ex) { lbMessage.Text = "更新错误:" + ex.Message; } ListView1.EditIndex = -1; databind(); }
protected void listViewTest_ItemUpdating(object sender, ListViewUpdateEventArgs e) { var id = int.Parse(e.NewValues["Id"].ToString()); var firstName = e.NewValues["FirstName"].ToString(); var lastName = e.NewValues["LastName"].ToString(); using (_db = new TestMixedVBWithCSharpEntities()) { var employee = _db.Employees.SingleOrDefault(emp => emp.ID == id); if (employee != null) { employee.FirstName = firstName; employee.LastName = lastName; _db.SaveChanges(); } } listViewTest.EditIndex = -1; PopulateListView(); }
protected void LvHomePageItems_ItemUpdating(object sender, ListViewUpdateEventArgs e) { //HomePageSetUpBE SetupBE = new HomePageSetUpBE(); //HomePageSetUpBAL SetupBAL = new HomePageSetUpBAL(); //DataTable dt = new DataTable(); //string HomePageId = LvHomePageItems.DataKeys[e.ItemIndex].Value.ToString(); //TextBox PageValidDateFrom = LvHomePageItems.Items[e.ItemIndex].FindControl("txtPageValidDateFrom") as TextBox; //TextBox PageValidDateTo = LvHomePageItems.Items[e.ItemIndex].FindControl("txtPageValidDateTo") as TextBox; //TextBox PageValidTimeFrom = LvHomePageItems.Items[e.ItemIndex].FindControl("txtPageValidTimeFrom") as TextBox; //TextBox PageValidTimeTo = LvHomePageItems.Items[e.ItemIndex].FindControl("txtPageValidTimeTo") as TextBox; //TextBox PageHtml = LvHomePageItems.Items[e.ItemIndex].FindControl("txtPageHtml") as TextBox; //HomePageSetUpBE setupBE = new HomePageSetUpBE(); //HomePageSetUpBAL setupBAL = new HomePageSetUpBAL(); //setupBE.HomePageId = Convert.ToInt32(HomePageId); //setupBE.PageValidDateFrom = Convert.ToDateTime(PageValidDateFrom.Text); //setupBE.PageValidDateTo = Convert.ToDateTime(PageValidDateTo.Text); //setupBE.PageValidTimeFrom = Convert.ToString(PageValidTimeFrom.Text); //setupBE.PageValidTimeTo = Convert.ToString(PageValidTimeTo.Text); //setupBE.PageHtml = PageHtml.Text; ////CatBE.CatLastModifiedBy = ((UserBE)Session["LoggedInUser"]).UserId; //if (SetupBAL.VerifyOverlapHomePage(setupBE, ref dt)) //{ // Response.Write("Sorry You Cannot Update Event To Already Existing Dates"); // BindHomePageList(); //} //else //{ // Response.Write("No Other events On the Same Date Proceed...."); // if (setupBAL.ModifyHomePage(setupBE)) // { // LvHomePageItems.EditIndex = -1; // BindHomePageList(); // Response.Write("<br/>" + "Record Successfully Updated"); // //LoggedIn master = (LoggedIn)this.Master; // //master.ShowMessage("Record successfully updated.", true); // } // else // { // Response.Write("UnSuccessful"); // //LoggedIn master = (LoggedIn)this.Master; // //master.ShowMessage("Unsuccessful", false); // } //} }
protected override void OnItemUpdating (ListViewUpdateEventArgs e) { RecordEvent ("Enter"); base.OnItemUpdating (e); RecordEvent ("Leave"); }
protected void lvEv_ItemUpdating(object sender, ListViewUpdateEventArgs e) { e.Cancel = !UpdateDetails(e.ItemIndex); IsEditing = e.Cancel; }
/// <summary> /// Themes the view item updating. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e"> /// The <see cref="System.Web.UI.WebControls.ListViewUpdateEventArgs"/> /// instance containing the event data.</param> protected void ThemeViewItemUpdating(object sender, ListViewUpdateEventArgs e) { var value = (DropDownList)ThemeView.EditItem.FindControl("editGroup"); e.NewValues.Add("GroupName", value.Text); }
/* * Yhden elokuvan päivittäminen * */ protected void ListView2_ItemUpdating(object sender, ListViewUpdateEventArgs e) { foreach (DictionaryEntry de in e.NewValues) { if (de.Value != null) { if (!de.Value.Equals(e.OldValues[de.Key])) { if (de.Key.ToString().Contains("DbTiedot")) { string propertyName = de.Key.ToString().Split('.')[1]; leffa.DbTiedot.Update(propertyName, de.Value.ToString()); if (propertyName.Equals("Title")) { leffa.Update("Nimi", de.Value.ToString()); } } else leffa.Update(de.Key.ToString(), de.Value.ToString()); if (de.Key.ToString().Equals("Watched") && bool.Parse(de.Value.ToString()) == true) { RssController.AddFeedAndSave(leffa.UserName, leffa.Nimi, "watch", ref db); } } } } if (leffa.DbTiedot.Poster.Equals("~/Images/No-Photo-Available.jpg")) { leffa.DbTiedot.Poster = null; } }
protected void lvContainers_ItemUpdating(object sender, ListViewUpdateEventArgs e) { ContainerInfo c = (ContainerInfo)lvContainers.EditItem.FindControl("ContainerInfo1"); q.Containers[lvContainers.EditIndex] = c.ContainerObject; lvContainers.EditIndex = -1; bindControls(); ViewState["Quote"] = q; ViewState["BeforeEdit"] = null; }
//更新数据 protected void lvPhoto_ItemUpdating(object sender, ListViewUpdateEventArgs e) { TextBox title = (TextBox)lvPhoto.Items[e.ItemIndex].FindControl("tbName"); TextBox description = (TextBox)lvPhoto.Items[e.ItemIndex].FindControl("tbDescript"); int DataKey = Int32.Parse(lvPhoto.DataKeys[e.ItemIndex].Value.ToString()); //通过LINQ to SQL实现修改操作 var results = from result in lqc.Photo where result.ID == DataKey select result; results.SingleOrDefault().Title = title.Text.Trim();//修改照片标题 results.SingleOrDefault().Descript = description.Text.Trim();//修改照片描述 lqc.SubmitChanges();//提交修改操作 ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('更新成功!');", true); BindListView();//重新绑定下ListView控件 }
protected void lvEducation_ItemUpdating(object sender, ListViewUpdateEventArgs e) { TextBox txtInstitutionName = (TextBox)(lvEducation.Items[e.ItemIndex].FindControl("txtInstitutionName")) as TextBox; TextBox txtDegreeTitle = (TextBox)(lvEducation.Items[e.ItemIndex].FindControl("txtDegreeTitle")) as TextBox; DropDownList DDCategory = (DropDownList)(lvEducation.Items[e.ItemIndex].FindControl("DDCategory")) as DropDownList; TextBox txtBatch = (TextBox)(lvEducation.Items[e.ItemIndex].FindControl("txtBatch")) as TextBox; Literal litPK = (Literal)(lvEducation.Items[e.ItemIndex].FindControl("litPK")) as Literal; String InstitutionName = "", DegreeTitle = "", Category = "", Batch = ""; InstitutionName = txtInstitutionName.Text; DegreeTitle = txtDegreeTitle.Text; Category = DDCategory.Text; Batch = txtBatch.Text; String cmdStr = "UPDATE Education SET Category = '" + Category + "', Batch = '" + Batch + "', " + "DegreeTitle = '" + DegreeTitle + "', InstitutionName = '" + InstitutionName + "' " + "WHERE Education_PK = '" + litPK.Text + "'"; SqlCommand scom = new SqlCommand(cmdStr, con); con.Open(); Boolean flg = false; //If there is an error no PostBack// if ((InstitutionName == "") || (DegreeTitle == "") || (Category == "") || (Batch == "")) { lblErrorInsert.Text = "Check the Entries, Date should be (MM/DD/YYYY)"; lblErrorInsert.Visible = true; flg = true; } try { if (!flg) { scom.ExecuteNonQuery(); } } catch { //Most Probably it is the date issue// //Give a msg saying the date should be in correct format// //And Recheck other entries// lblErrorInsert.Text = "Check the Entries, Date should be (MM/DD/YYYY)"; lblErrorInsert.Visible = true; flg = true; } finally { con.Close(); } if (!flg) { Server.Transfer("editEducation.aspx"); } }
protected void ListView1_ItemUpdating(object sender, ListViewUpdateEventArgs e) { ListView1.EditIndex = -1; loadData(); }
protected virtual void OnItemUpdating(ListViewUpdateEventArgs e) { EventHandler<ListViewUpdateEventArgs> handler = (EventHandler<ListViewUpdateEventArgs>)Events[EventItemUpdating]; if (handler != null) { handler(this, e); } else { if (IsDataBindingAutomatic == false && e.Cancel == false) { throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, AtlasWeb.ListView_UnhandledEvent, ID, "ItemUpdating")); } } }
protected void DetailListView_ItemUpdating(object sender, ListViewUpdateEventArgs e) { OpenDetialDialog(); }
/// <summary> /// make sure calculated fields are set on update /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lvwTaskComments_ItemUpdating(object sender, ListViewUpdateEventArgs e) { e.NewValues["FK_Task"] = hdfSelectedTaskId.Value; e.NewValues["ChangedOn"] = DateTime.Now; e.NewValues["ChangedBy"] = Membership.GetUser() != null ? Membership.GetUser().ToString() : "anonymous"; }
/// <summary> /// To cope with the us date bug. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lvwTasks_ItemUpdating(object sender, ListViewUpdateEventArgs e) { if (e.NewValues["DueDate"] != null) e.NewValues["DueDate"] = GUIHelper.GetUSDate(e.NewValues["DueDate"].ToString()); //if actually not required but due to a bug where created on was deleted I need to check this here if (e.NewValues["CreatedOn"] != null) e.NewValues["CreatedOn"] = GUIHelper.GetUSDate(e.NewValues["CreatedOn"].ToString()); e.NewValues["ChangedOn"] = DateTime.Now; e.NewValues["ChangedBy"] = Membership.GetUser().UserName; }
private void HandleUpdate(ListViewItem item, int itemIndex, bool causesValidation) { ListViewDataItem dataItem = item as ListViewDataItem; if (itemIndex < 0 && dataItem == null) { throw new InvalidOperationException(AtlasWeb.ListView_InvalidUpdate); } if (causesValidation && Page != null && !Page.IsValid) { return; } DataSourceView view = null; bool isBoundToDataSourceControl = IsDataBindingAutomatic; if (isBoundToDataSourceControl) { view = GetData(); if (view == null) { throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, AtlasWeb.ListView_NullView, ID)); } } ListViewUpdateEventArgs e = new ListViewUpdateEventArgs(itemIndex); foreach (DictionaryEntry entry in BoundFieldValues) { e.OldValues.Add(entry.Key, entry.Value); } if (DataKeys.Count > itemIndex) { foreach (DictionaryEntry entry in DataKeys[itemIndex].Values) { e.Keys.Add(entry.Key, entry.Value); } } if (dataItem == null && Items.Count > itemIndex) { dataItem = Items[itemIndex]; } if (dataItem != null) { ExtractItemValues(e.NewValues, dataItem, true/*includePrimaryKey*/); } OnItemUpdating(e); if (e.Cancel) { return; } if (isBoundToDataSourceControl) { _updateKeys = e.Keys; _updateOldValues = e.OldValues; _updateNewValues = e.NewValues; view.Update(e.Keys, e.NewValues, e.OldValues, HandleUpdateCallback); } }
protected void lvwSitemapData_ItemUpdating(object sender, ListViewUpdateEventArgs e) { }
protected void UsuariosListView_ItemUpdating(object sender, System.Web.UI.WebControls.ListViewUpdateEventArgs e) { e.NewValues["Senha"] = HashingUtils.Hash((string)e.NewValues["SenhaPlain"]); }