protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { modelNb.discription = gs; modelNb.title = DropDownList1.SelectedValue; modelNb = nb.getNews(modelNb); content1.Value = modelNb.msg; }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { if (Session["language"] != null && Session["language"].ToString() == "en-us") { modelNb.title_eng = DropDownList1.SelectedValue; modelNb = nb.getNews(modelNb); content1.Value = modelNb.msg_eng; } else { modelNb.title = DropDownList1.SelectedValue; modelNb = nb.getNews(modelNb); content1.Value = modelNb.msg; } }
protected void Button1_Click(object sender, EventArgs e) { if (this.Button2.Text == "取消")//代表现在为新增状态 { if (this.TextBox1.Text == "") { Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('标题不能为空');</script>"); } else { try { modelNb.discription = gs; modelNb.title = this.TextBox1.Text; modelNb.msg = content1.Value.Replace("'", "''"); nb.NewsAdd(modelNb); this.TextBox1.Text = ""; this.content1.Value = ""; Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('新增成功!');</script>"); //Response.Redirect("healthshopinfo.aspx", true); } catch (Exception ex) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('新增失败!" + ex.Message + "');</script>"); } } } else { try { modelNb.discription = gs; modelNb.title = DropDownList1.SelectedValue; modelNb = nb.getNews(modelNb); modelNb.msg = content1.Value.Replace("'", "''"); nb.update(modelNb); Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('更新成功!');</script>"); } catch (Exception ex) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('保存失败!" + ex.Message + "');</script>"); } } }
protected void Button1_Click(object sender, EventArgs e) { try { modelNb.discription = gs; modelNb.title = DropDownList1.SelectedValue; modelNb = nb.getNews(modelNb); modelNb.title = TextBox1.Text; modelNb.msg = content1.Value.Replace("'", "''"); nb.update(modelNb); int si = this.DropDownList1.SelectedIndex; this.DropDownList1.DataBind(); this.DropDownList1.SelectedIndex = si; Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('更新成功!');</script>"); } catch (Exception ex) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('保存失败!" + ex.Message + "');</script>"); } }
protected void Button1_Click(object sender, EventArgs e) { try { if (Session["language"] != null && Session["language"].ToString() == "en-us") { modelNb.title_eng = DropDownList1.SelectedValue; modelNb = nb.getNews(modelNb); modelNb.msg_eng = content1.Value.Replace("'", "''"); } else { modelNb.title = DropDownList1.SelectedValue; modelNb = nb.getNews(modelNb); modelNb.msg = content1.Value.Replace("'", "''"); } nb.update(modelNb); Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('更新成功!');</script>"); } catch (Exception ex) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('保存失败!" + ex.Message + "');</script>"); } }
protected void Button1_Click(object sender, EventArgs e) { if (this.TextBox2.Text == "") { Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('请复制文件链接到[编辑链接]文本框!');</script>"); return; } else if (!this.TextBox2.Text.ToLower().Contains(".pdf") || !System.IO.File.Exists(Server.MapPath("~/" + this.TextBox2.Text))) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('找不到文件链接!');</script>"); return; } if (this.Button2.Text == "取消")//代表现在为新增状态 { if (this.TextBox1.Text == "" || this.TextBox3.Text == "") { Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('标题不能为空');</script>"); } else { try { modelNb.discription = gs + cb.getcompanyname(this.TextBox3.Text); modelNb.title = this.TextBox1.Text; modelNb.msg = content1.Value.Replace("'", "''"); modelNb.link = this.TextBox2.Text; modelNb.time = DateTime.Now; nb.NewsAdd(modelNb); this.TextBox1.Text = ""; this.TextBox3.Text = ""; this.TextBox2.Text = ""; this.content1.Value = ""; Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('新增成功!');</script>"); //Response.Redirect("healthshopinfo.aspx", true); } catch (Exception ex) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('新增失败!" + ex.Message + "');</script>"); } } } else { try { if (Session["language"] != null && Session["language"].ToString() == "en-us") { modelNb.title_eng = DropDownList1.SelectedValue; modelNb = nb.getNews(modelNb); modelNb.link_eng = this.TextBox2.Text; modelNb.msg_eng = content1.Value.Replace("'", "''"); modelNb.msg = modelNb.msg.Replace("'", "''"); } else { modelNb.title = DropDownList1.SelectedValue; modelNb = nb.getNews(modelNb); modelNb.link = this.TextBox2.Text; modelNb.msg = content1.Value.Replace("'", "''"); modelNb.msg_eng = modelNb.msg_eng.Replace("'", "''"); } nb.update(modelNb); Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('更新成功!');</script>"); } catch (Exception ex) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('保存失败!" + ex.Message + "');</script>"); } } }