protected void dvControl_ItemUpdating(object sender, DetailsViewUpdateEventArgs e) { DetailsView dv = (DetailsView)sender; //------------------------------------------------------------------------- e.NewValues["time_zone"] = timeZone; //------------------------------------------------------------------------- TextBox txtNewPassword = (TextBox)dv.FindControl("txtNewPassword"); TextBox txtConfirmPassword = (TextBox)dv.FindControl("txtConfirmPassword"); if (txtNewPassword.Text.CompareTo(txtConfirmPassword.Text) == 0) { e.NewValues["password"] = txtNewPassword.Text; } else { this.showErrorMessage("Passwords do not match, please retype!"); e.Cancel = true; } if (e.Cancel) { e.NewValues["password"] = e.OldValues["password"]; } }
protected void dvService_DataBound(object sender, EventArgs e) { DetailsView dv = sender as DetailsView; if (dv.DataItem != null) { DataRow dr = ((DataRowView)dv.DataItem).Row; string imagePath = String.Format("~/Upload/ExpertPhoto/{0}.jpg", dr["ExpertId"]); if (File.Exists(Server.MapPath(imagePath))) { imgPhoto.ImageUrl = imagePath; } if (dv.CurrentMode == DetailsViewMode.Edit) { DropDownList ddlServiceType = dv.FindControl("ddlServiceType") as DropDownList; Label lblServiceType = dv.FindControl("lblServiceType") as Label; ddlServiceType.SelectedValue = lblServiceType.Text; // Check if this service belong to current logon expert, if no, deny edit mode. int serviceExpertId = Convert.ToInt32(dr["ExpertId"]); int currentExpertId = Convert.ToInt32(Session["ExpertId"]); if (serviceExpertId != currentExpertId) { dv.ChangeMode(DetailsViewMode.ReadOnly); } } } }
protected void ActivitiesDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e) { DetailsView vw = (DetailsView)sender; DropDownList ddApplicationDetailsTypes = ((DropDownList)vw.FindControl("ddApplicationDetailsTypes")) as DropDownList; DropDownList ddGroupsDetails = (DropDownList)vw.FindControl("ddGroupsDetails") as DropDownList; SueetieApplication sueetieApplication = new SueetieApplication(); if (e.Values["ApplicationKey"] == null || e.Values["ApplicationID"] == null) { sueetieApplication.ApplicationKey = "ERROR"; sueetieApplication.Description = "All fields required"; } else { sueetieApplication.ApplicationID = int.Parse(e.Values["ApplicationID"].ToString().Trim()); sueetieApplication.ApplicationKey = e.Values["ApplicationKey"].ToString(); sueetieApplication.Description = e.Values["Description"].ToString(); sueetieApplication.GroupID = int.Parse(ddGroupsDetails.SelectedValue); sueetieApplication.ApplicationTypeID = int.Parse(ddApplicationDetailsTypes.SelectedValue); } e.Values.Remove("GroupID"); e.Values.Remove("Description"); e.Values.Remove("ApplicationTypeID"); e.Values.Remove("ApplicationKey"); e.Values.Add("appKey", sueetieApplication.ApplicationKey); e.Values.Add("appDescription", sueetieApplication.Description); e.Values.Add("groupID", sueetieApplication.GroupID); e.Values.Add("appTypeID", sueetieApplication.ApplicationTypeID); }
protected void InsertBtn_Click(object sender, EventArgs e) { Button ibtn = (Button)sender; DetailsView d2 = (DetailsView)ibtn.FindControl("DetailsView1"); Label llll = (Label)d2.FindControl("Label_errno"); TextBox tbx1 = (TextBox)d2.FindControl("TextBox1"); DropDownList ddlist2 = (DropDownList)d2.FindControl("DropDownList2"); //IconNum:6 positive、5 negative try { if (llll.Text == "" || tbx1.Text == "") { throw new ArgumentNullException(); } cc1.connectionofc008_modify("insert into ecsfc932_ud(errno,errdsca,type) values('" + llll.Text + "','" + tbx1.Text + "','" + ddlist2.SelectedValue + "')"); GridView2.DataSourceID = "SqlDataSource1"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "nulltip2", "nulltip2('新增成功!!',6)", true); } catch (ArgumentNullException ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "nulltip2", "nulltip2('欄位不可有空!!',5)", true); } catch (SqlException sqlexcp) { //用replace替換掉exception陳述式中出現的換行符號\r\n //以避免javascript因判斷不出字元而導致function出錯 string SqlExcpStr = sqlexcp.Message.Replace(Environment.NewLine, ""); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "nulltip2", "nulltip2('" + SqlExcpStr + "',5)", true); } }
///--------------------------------------------------------------------------------- ///--------------------------------------------------------------------------------- protected void dvControl_DataBound(object sender, EventArgs e) { DetailsView dv = (DetailsView)sender; DropDownList ddlUserRoles = (DropDownList)dv.FindControl("ddlUserRoles"); HiddenField hf = (HiddenField)dv.FindControl("hfUserRoleId"); ddlUserRoles.DataSource = BllProxyLookup.GetUserRoles(); // 3:Managers ddlUserRoles.DataBind(); ListItem item = new ListItem("select user role", ""); ddlUserRoles.Items.Insert(0, item); if (hf.Value != "") { userRoleId = Convert.ToInt32(hf.Value); } ListItem currentItem = ddlUserRoles.Items.FindByValue(userRoleId.ToString()); if (currentItem != null) { currentItem.Selected = true; } else { ddlUserRoles.Items.FindByValue("").Selected = true; } }
protected void dvOrderEdit_OnDataBound(object sender, EventArgs e) { DetailsView myDetailsView = (DetailsView)sender; if (myDetailsView.CurrentMode == DetailsViewMode.Insert) { // QOnT.classes.TrackerTools tt = new classes.TrackerTools(); // DateTime dt = tt.GetClosestNextRoastDate(DateTime.Now); // if there session has lost vars re-initializa if (Session[SV_ORDERVALUES] == null) { InitializeOrderVars(); } // retrieve values OrderValues _MyOrderValues = (OrderValues)Session[SV_ORDERVALUES]; // take values from session and set them ((DropDownList)myDetailsView.FindControl(DV_CONTROL_CUSTOMER)).SelectedIndex = _MyOrderValues.CustomerID; ((TextBox)myDetailsView.FindControl(DV_CONTROL_ORDER_DATE)).Text = _MyOrderValues.dtOrder.ToString("d"); ((TextBox)myDetailsView.FindControl(DV_CONTROL_ROAST_DATE)).Text = _MyOrderValues.dtRoast.ToString("d"); ((TextBox)myDetailsView.FindControl(DV_CONTROL_REQUIRED_BY_DATE)).Text = _MyOrderValues.dtRequiredBy.ToString("d"); ((DropDownList)myDetailsView.FindControl(DV_CONTROL_DELIVERY_BY)).SelectedIndex = _MyOrderValues.DeliverByID; ((TextBox)myDetailsView.FindControl(DV_CONTROL_QTY)).Text = "1"; ((CheckBox)myDetailsView.FindControl(DV_CONTROL_CONFIRMED)).Checked = _MyOrderValues.IsConfirmed; ((TextBox)myDetailsView.FindControl(DV_CONTROL_NOTES)).Text = _MyOrderValues.Notes; } }
protected void DetailsView_ItemUpdating(object sender, DetailsViewUpdateEventArgs e) { DateTime a; String oldName = (String)Session["PlayerDetailsName"]; string newName = ((TextBox)DetailsView.FindControl("NameTxt")).Text; int Jersey = Convert.ToInt32(((TextBox)DetailsView.FindControl("JerseyTxt")).Text); String Dob = ((TextBox)DetailsView.FindControl("DobTxt")).Text; if (newName != "") { if (DateTime.TryParse(Dob, out a) == true) { SqlCommand command = new SqlCommand(); command.CommandText = "UpdatePlayerDetails"; command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("OldName", SqlDbType.VarChar); command.Parameters["OldName"].Value = oldName; command.Parameters.Add("NewName", SqlDbType.VarChar); command.Parameters["NewName"].Value = newName; command.Parameters.Add("NewJersey", SqlDbType.Int); command.Parameters["NewJersey"].Value = Jersey; command.Parameters.Add("NewDOB", SqlDbType.Date); command.Parameters["NewDOB"].Value = a; DataConnection myConnection = new DataConnection(); myConnection.ExecuteNonQuery(command); DetailsView.ChangeMode(DetailsViewMode.ReadOnly); BindDetails(); } } if (oldName != newName) { Response.Redirect("ClubDetails.aspx#Body"); } }
protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e) { FileUpload fileUpload = (FileUpload)((DetailsView)sender).FindControl("fileUpload"); Label sttUpload = (Label)((DetailsView)sender).FindControl("sttImageUpload"); Binary imageBinary = ImageHelper.getUploadImage(fileUpload, sttUpload); if (imageBinary != null) { TRAVEL_WEBDataContext context = new TRAVEL_WEBDataContext(); var hinhanh = (from tx in context.TRAM_XEs where tx.MaTramXe == int.Parse((string)e.Keys["MaTramXe"].ToString()) select tx.HinhAnh).Single(); if (hinhanh == null || hinhanh < 1) { e.NewValues["HinhAnh"] = ImageHelper.insertImage(imageBinary); } else { ImageHelper.updateImage(imageBinary, (int)hinhanh); } } DetailsView detail = (DetailsView)sender; DropDownList ddlNhanViens = (DropDownList)detail.FindControl("ddlNhanViens"); e.NewValues["MaTruongTram"] = ddlNhanViens.SelectedValue; }
protected void OwnerDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e) { DetailsView ClientDetailsView = (DetailsView)sender; DropDownList ddlClientTypes = (DropDownList)ClientDetailsView.FindControl("ddlClientTypes"); if (ddlClientTypes.SelectedValue == "Private") { e.Values["IsLaw"] = false; e.Values["IsForeigner"] = false; } if (ddlClientTypes.SelectedValue == "Law") { e.Values["IsLaw"] = true; e.Values["IsForeigner"] = false; } if (ddlClientTypes.SelectedValue == "ForeignPrivate") { e.Values["IsLaw"] = false; e.Values["IsForeigner"] = true; } if (ddlClientTypes.SelectedValue == "ForeignLaw") { e.Values["IsLaw"] = true; e.Values["IsForeigner"] = true; } }
protected void dvManutencao_ItemUpdating(object sender, DetailsViewUpdateEventArgs e) { DetailsView detailsView = (DetailsView)sender; CheckBoxList chkTipoPessoa = (CheckBoxList)detailsView.FindControl("chkTipoPessoa"); List <dtoListItem> lstTipoPessoa = bllDataTable.GetTipoPessoa(); foreach (dtoListItem item in lstTipoPessoa) { e.NewValues.Add(item.ValorChave, false); } foreach (ListItem item in chkTipoPessoa.Items) { e.NewValues[item.Value] = false; } foreach (ListItem item in chkTipoPessoa.Items) { if (item.Selected) { e.NewValues[item.Value] = true; } } }
/// <summary> /// Buscar o valor do controle baseado em seu nome /// </summary> /// <param name="controlName"></param> /// <param name="detailsView"></param> /// <returns></returns> public static string GetTextFieldValue(string controlName, DetailsView detailsView) { object fieldValue = null; object ctl = detailsView.FindControl(controlName); if (ctl == null) { throw new Exception(string.Format("GetTextFieldValue: could not find {0} control!", controlName)); } if (ctl.GetType() == typeof(TextBox)) { fieldValue = ((TextBox)ctl).Text; } else if (ctl.GetType() == typeof(DropDownList)) { fieldValue = ((DropDownList)ctl).SelectedValue; } else if (ctl.GetType() == typeof(CheckBox)) { fieldValue = ((CheckBox)ctl).Checked; } else if (ctl.GetType() == typeof(Label)) { fieldValue = ((Label)ctl).Text; } return(fieldValue.ToString()); }
protected void DetailsView1_DataBound(object sender, EventArgs e) { DetailsView detail = (DetailsView)sender; DropDownList ddlNhanViens = (DropDownList)detail.FindControl("ddlNhanViens"); ddlNhanViens.SelectedValue = ((TRAM_XE)detail.DataItem).MaTruongTram.ToString(); }
protected void dvService_ItemInserting(object sender, DetailsViewInsertEventArgs e) { DetailsView dv = sender as DetailsView; DropDownList ddlServiceType = dv.FindControl("ddlServiceType") as DropDownList; e.Values["Type"] = ddlServiceType.SelectedValue; e.Values["ExpertId"] = Session["ExpertId"]; }
protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e) { DetailsView dv = (DetailsView)sender; DropDownList ddl = dv.FindControl("DropDownList5") as DropDownList; e.NewValues.Add("ParentId", ddl.SelectedValue); }
protected void dvOrderEdit_OnItemInserted(object sender, EventArgs e) { DetailsView myDetailsView = (DetailsView)sender; // QOnT.classes.TrackerTools tt = new classes.TrackerTools(); // DateTime dt = tt.GetClosestNextRoastDate(DateTime.Now); // retrieve values OrderValues _MyOrderValues = new OrderValues(); // take values from session and set them DropDownList _ddlCustomers = ((DropDownList)myDetailsView.FindControl(DV_CONTROL_CUSTOMER)); _MyOrderValues.CustomerID = _ddlCustomers.SelectedIndex; _MyOrderValues.dtOrder = Convert.ToDateTime(((TextBox)myDetailsView.FindControl(DV_CONTROL_ORDER_DATE)).Text); _MyOrderValues.dtRoast = Convert.ToDateTime(((TextBox)myDetailsView.FindControl(DV_CONTROL_ROAST_DATE)).Text); _MyOrderValues.dtRequiredBy = Convert.ToDateTime(((TextBox)myDetailsView.FindControl(DV_CONTROL_REQUIRED_BY_DATE)).Text); _MyOrderValues.DeliverByID = ((DropDownList)myDetailsView.FindControl(DV_CONTROL_DELIVERY_BY)).SelectedIndex; _MyOrderValues.IsConfirmed = ((CheckBox)myDetailsView.FindControl(DV_CONTROL_CONFIRMED)).Checked; _MyOrderValues.Notes = ((TextBox)myDetailsView.FindControl(DV_CONTROL_NOTES)).Text; // save the values Session[SV_ORDERVALUES] = _MyOrderValues; ltrlStatus.Text = "Order added for customer: " + _ddlCustomers.SelectedValue; // now bind the GridView BindGridViewData(sender, e); ddlFilterBy.Focus(); this.Form.DefaultButton = btnGo.UniqueID; }
protected void dvOrderEdit_OnModeChanged(object sender, EventArgs e) { // focus control onto the ddl DetailsView myDetailsView = (DetailsView)sender; if ((dvOrderEdit.CurrentMode == DetailsViewMode.Edit) || (dvOrderEdit.CurrentMode == DetailsViewMode.Insert)) { myDetailsView.FindControl(DV_CONTROL_CUSTOMER).Focus(); } }
private string CreateInvitationSmsBody(BidDetails biddetails, BidParticipant participant) { //return String.Format("The Deadline for the: ", biddetails.Description, biddetails.ID, biddetails.SubmissionDeadline.ToString("MM/dd/yyyy hh:mm:ss tt")); DetailsView dv = Biddetails_details1.FindControl("dvEventDetails") as DetailsView; Label lblPreviousDeadline = dv.FindControl("lblDeadline") as Label; String textMessage = "‘Submission Deadline of Bid reference Number: " + biddetails.ID + " has been changed from " + Convert.ToDateTime(lblPreviousDeadline.Text).ToString("MMMM dd, yyyy, hh:mm tt") + " to " + biddetails.SubmissionDeadline.ToString("MMMM dd, yyyy, hh:mm tt") + ".’"; return(textMessage); }
protected void DetailsView_DataBound(object sender, EventArgs e) { DropDownList ddl = DetailsView.FindControl("ddlServerType") as DropDownList; ddl.DataSource = Enum.GetValues(typeof(DbServer)); ddl.DataBind(); if (project != null) { ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByText(project.ServerType.ToString())); } ddl.Items.RemoveAt(0); }
///--------------------------------------------------------------------------------- ///--------------------------------------------------------------------------------- protected void dvControl_DataBound(object sender, EventArgs e) { DetailsView dv = (DetailsView)sender; DropDownList ddlQuestionTypes = (DropDownList)dv.FindControl("ddlQuestionTypes"); HiddenField hf = (HiddenField)dv.FindControl("hfQuestionTypeId"); if (hf.Value != "") { questinTypeId = Convert.ToInt32(hf.Value); } if (ddlQuestionTypes != null) { ddlQuestionTypes.DataSource = BllProxyLookup.GetQuestionTypes(); ddlQuestionTypes.DataBind(); ListItem item = new ListItem("select type", "0"); ddlQuestionTypes.Items.Insert(0, item); ListItem currentItem = ddlQuestionTypes.Items.FindByValue(questinTypeId.ToString()); if (currentItem != null) { currentItem.Selected = true; } else { ddlQuestionTypes.Items.FindByValue("0").Selected = true; } } if (this.ReadOnly) { dv.Rows[6].Visible = false; } }
protected void UserDetailsView_ItemInserted(object sender, EventArgs e) { DetailsView udv = (DetailsView)sender; TextBox sp = (TextBox)udv.FindControl("SubscProducts"); //udv.ro UsersGridView.DataBind(); //sindex = UsersGridView.Rows.Count; // GridViewRow r = UsersGridView.Rows[sindex]; //UsersGridView.SelectedIndex = sindex; // UsersGridView.SelectRow(sindex); }
protected void dvManutencao_DataBound(object sender, EventArgs e) { if (dvManutencao.CurrentMode == DetailsViewMode.Edit) { DetailsView detailsView = (DetailsView)sender; dtoPessoa pessoa = (dtoPessoa)detailsView.DataItem; CheckBoxList chkTipoPessoa = (CheckBoxList)detailsView.FindControl("chkTipoPessoa"); List <dtoListItem> lstTipoPessoa = bllDataTable.GetTipoPessoa(); foreach (dtoListItem item in lstTipoPessoa) { chkTipoPessoa.Items.FindByValue(item.ValorChave).Selected = (bool)pessoa.GetValue(item.ValorChave); } } }
protected void ddlEspeciePessoa_Click(object sender, EventArgs e) { DropDownList ddlEspeciePessoa = (DropDownList)sender; DetailsView detailsView = (DetailsView)ddlEspeciePessoa.NamingContainer; CheckBoxList chkTipoPessoa = (CheckBoxList)detailsView.FindControl("chkTipoPessoa"); bool tipoPessoaColaborador = false; bool tipoPessoaCliente = false; bool tipoPessoaParte = false; bool tipoPessoaTerceiro = false; bool tipoPessoaAdvogado = false; foreach (ListItem item in chkTipoPessoa.Items) { if (item.Selected) { switch (item.Value) { case "tipoPessoaColaborador": tipoPessoaColaborador = true; break; case "tipoPessoaCliente": tipoPessoaCliente = true; break; case "tipoPessoaParte": tipoPessoaParte = true; break; case "tipoPessoaTerceiro": tipoPessoaTerceiro = true; break; case "tipoPessoaAdvogado": tipoPessoaAdvogado = true; break; } } } ConfiguraTipoPessoa(ddlEspeciePessoa.SelectedValue, tipoPessoaColaborador, tipoPessoaAdvogado, tipoPessoaCliente, tipoPessoaParte, tipoPessoaTerceiro); ConfiguraModoCRUD(detailsView.CurrentMode, ddlEspeciePessoa.SelectedValue, tipoPessoaColaborador, tipoPessoaAdvogado, tipoPessoaCliente, tipoPessoaParte, tipoPessoaTerceiro); }
protected void DetailsView1_DataBound(object sender, EventArgs e) { DetailsView DV = (DetailsView)sender; if (DV.CurrentMode == DetailsViewMode.Edit) { DropDownList ddl = DV.FindControl("DropDownList5") as DropDownList; if (ddl != null) { BusinessObject.Topics topic = DV.DataItem as BusinessObject.Topics; if (topic != null) { ddl.SelectedValue = Convert.ToString(topic.ParentId); } } } }
protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e) { FileUpload fileUpload = (FileUpload)((DetailsView)sender).FindControl("fileUpload"); Label sttUpload = (Label)((DetailsView)sender).FindControl("sttImageUpload"); Binary imageBinary = ImageHelper.getUploadImage(fileUpload, sttUpload); if (imageBinary == null) { sttUpload.Text = "Chưa nhập hình ảnh trạm"; e.Cancel = true; return; } e.Values["HinhAnh"] = ImageHelper.insertImage(imageBinary); DetailsView detail = (DetailsView)sender; DropDownList ddlNhanViens = (DropDownList)detail.FindControl("ddlNhanViens"); e.Values["MaTruongTram"] = ddlNhanViens.SelectedValue; }
//protected void DetailsView_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) //{ // //DetailsView.EditIndex = -1; //swicth back to default mode // BindDetailsview(); // Rebind GridView to show the data in default mode //} protected void DetailsView_ItemUpdating(object sender, DetailsViewUpdateEventArgs e) { //string Name = ((TextBox)DetailsView.FindControl("Name")).Text; string address = ((TextBox)DetailsView.FindControl("Address")).Text; string contact = ((TextBox)DetailsView.FindControl("Contact")).Text; DataSet ds = new DataSet(); string s1 = ConfigurationManager.ConnectionStrings["Connection"].ToString(); using (SqlConnection con = new SqlConnection(s1)) { SqlCommand cmd = new SqlCommand("update registrationdetailstable set Phnum = '" + contact + "' ,Addres= '" + address + "' where email = '" + Session["Useremail"] + "'", con); SqlDataAdapter da = new SqlDataAdapter(cmd); cmd.CommandType = CommandType.Text; con.Open(); cmd.ExecuteNonQuery(); } Response.Redirect("Details.aspx"); }
protected void SavePermissions(DetailsView dv, SRPGroup obj) { GridView gv = (GridView)dv.FindControl("gvGroupPermissions"); string groupPermissions = string.Empty; foreach (GridViewRow row in gv.Rows) { if (((CheckBox)row.FindControl("isChecked")).Checked) { groupPermissions = string.Format("{0},{1}", groupPermissions, ((Label)row.FindControl("PermissionID")).Text); } } if (groupPermissions.Length > 0) { groupPermissions = groupPermissions.Substring(1, groupPermissions.Length - 1); } SRPGroup.UpdatePermissions(obj.GID, groupPermissions, ((SRPUser)Session[SessionData.UserProfile.ToString()]).Username); }
protected void SaveUsers(DetailsView dv, SRPGroup obj) { GridView gv = (GridView)dv.FindControl("gvGroupUsers"); string memberUsers = string.Empty; foreach (GridViewRow row in gv.Rows) { if (((CheckBox)row.FindControl("isMember")).Checked) { memberUsers = string.Format("{0},{1}", memberUsers, ((Label)row.FindControl("UID")).Text); } } if (memberUsers.Length > 0) { memberUsers = memberUsers.Substring(1, memberUsers.Length - 1); } SRPGroup.UpdateMemberUsers(obj.GID, memberUsers, ((SRPUser)Session[SessionData.UserProfile.ToString()]).Username); }
protected string CoalesceBadges(DetailsView dv) { var gv = (GridView)dv.FindControl("gvBadgeMembership"); string badgesList = ""; foreach (GridViewRow row in gv.Rows) { if (((CheckBox)row.FindControl("isMember")).Checked) { badgesList = string.Format("{0},{1}", badgesList, ((Label)row.FindControl("BID")).Text); } } if (badgesList.Length > 0) { badgesList = badgesList.Substring(1, badgesList.Length - 1); } return(badgesList); }
protected void SaveGroups(DetailsView dv, SRPUser obj) { GridView gv = (GridView)dv.FindControl("gvUserGroups"); string memberGroups = ""; foreach (GridViewRow row in gv.Rows) { if (((CheckBox)row.FindControl("isMember")).Checked) { memberGroups = string.Format("{0},{1}", memberGroups, ((Label)row.FindControl("GID")).Text); } } if (memberGroups.Length > 0) { memberGroups = memberGroups.Substring(1, memberGroups.Length - 1); } SRPUser.UpdateMemberGroups((int)obj.Uid, memberGroups, ((SRPUser)Session[SessionData.UserProfile.ToString()]).Username); }
protected void btnSearchOwnerEMBG_Click(object sender, EventArgs e) { TextBox tbEmbg = DetailsView1.FindControl("tbOwnerEMBG") as TextBox; Broker.DataAccess.Client o = Broker.DataAccess.Client.GetByEmbg(tbEmbg.Text); if (o != null) { ViewState["OwnerID"] = o.ID; TextBox tbName = DetailsView1.FindControl("tbOwnerName") as TextBox; tbName.Text = o.Name; Panel ownerPanel = DetailsView1.FindControl("pnlOwner") as Panel; ownerPanel.Visible = false; } else { Panel ownerPanel = DetailsView1.FindControl("pnlOwner") as Panel; ownerPanel.Visible = true; DetailsView dvClient = DetailsView1.FindControl("OwnerDetailsView") as DetailsView; TextBox tbOwnerEMBG = dvClient.FindControl("tbEMBG") as TextBox; tbOwnerEMBG.Text = tbEmbg.Text; } }
/*********************************************************************** * Set Default value to Date and UserName to Details View **********************************************************************/ protected void SetDefaultValue(DetailsView dw, string MyView) { if (dw.CurrentMode == DetailsViewMode.Insert || dw.CurrentMode == DetailsViewMode.Edit) { TextBox EditDate = dw.FindControl("TextBox1") as TextBox; EditDate.Text = DateTime.Now.ToShortDateString(); string[] strs = Master.PropertyMasterlblUser.Text.Split(' '); TextBox EditBy = dw.FindControl("TextBox2") as TextBox; EditBy.Text = strs[2]; /* for insert of DetailsView1, default value for SubmitDate and Submit by are needed */ if ((dw.CurrentMode == DetailsViewMode.Insert) && (MyView == "view1")) { TextBox SubmitDate = dw.FindControl("TextBox4") as TextBox; SubmitDate.Text = DateTime.Now.ToShortDateString(); TextBox SubmitBy = dw.FindControl("TextBox3") as TextBox; SubmitBy.Text = strs[2]; DropDownList SectionDropDown = dw.FindControl("DropDownList5") as DropDownList; SectionDropDown.SelectedValue = "83"; } /* the DetailsView2 can only be Updated, insert is not relivant, so, Turn it Off */ if (MyView == "view1") { DetailsView2.Visible = false; } } else { DetailsView2.Visible = true; } }