//電話號碼驗證 protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args) { if (txtPhone.Text.Length >= 9 && txtPhone.Text.Length <= 20) { args.IsValid = true; } else { args.IsValid = false; AddMethodSystem.ShowBox(UpdatePanel1, this.GetType(), "insertContact", "alert('At least input 9~20 numbers');"); } }
protected void GoToPage_TextChanged(object sender, EventArgs e) { TextBox txtgotopage = (TextBox)sender; int pageNumber; if (int.TryParse(txtgotopage.Text.Trim(), out pageNumber) && pageNumber > 0 && pageNumber <= this.GridView1.PageCount) { this.GridView1.PageIndex = pageNumber - 1; } else { this.GridView1.PageIndex = GridView1.PageCount - 1; AddMethodSystem.ShowBox(UpdatePanel1, this.GetType(), "valuebig", "alert('超出分頁最大值');window.location.href"); ObjectDataSource1.FilterExpression = AddMethodSystem.DecodeHtml2(AddMethodSystem.SearchWHEREStringObject("pc_name", txtKeyWord.Text, int.Parse(ddrCategory.SelectedValue), "pc_fatherid", lid, "l_id", "")); } }
protected void ImgbtnSubmit_Click(object sender, ImageClickEventArgs e) { if (Page.IsValid) { ContactInfo info = new ContactInfo(); info.c_name = txtName.Text; info.c_subject = txtSubject.Text; info.c_detail = txtDetail.Text; info.c_mail = txtEmail.Text; info.c_phone1 = txtPhone.Text; info.c_phone2 = txtFax.Text; info.c_pose_date = DateTime.Now; info.l_id = 2;//英文 if (cBLL.Insert(info) > 0) { AddMethodSystem.ShowBox(UpdatePanel1, this.GetType(), "insertContact", "alert('Thanks for your message! We will contact you soon...');document.location.href='index.aspx'"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["name"] != null && Request.QueryString["checkcode"] != null) { MemberInfo info = mBLL.GetDataByAccountAndCheckcode(Request.QueryString["name"].ToString(), Request.QueryString["checkcode"].ToString()); if (info.m_id != 0) { mBLL.Update(info); AddMethodSystem.ShowBox(UpdatePanel1, this.GetType(), "CheckSuccess", "alert('驗證成功');window.location.href='List.aspx';"); } else { AddMethodSystem.ShowBox(UpdatePanel1, this.GetType(), "fail", "alert('查無此人');"); } } else { Response.Redirect("List.aspx"); Response.End(); } }