using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.SqlClient; public partial class SysAdmin_UpdataSort : System.Web.UI.Page { public DataSet ds; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.DropDownList1.DataSource = BindDDl(); DropDownList1.DataTextField = "name_cn"; DropDownList1.DataValueField = "ID"; DropDownList1.DataBind(); DropDownList1.Items.Insert(0, new ListItem("一级类别", "0")); string id = Request.QueryString["id"].ToString(); string sqlstr = " select *from v3_m_category where id = " + id; ds = new common().ExcuteReader(sqlstr); this.txtSortCN.Text = ds.Tables[0].Rows[0][1].ToString(); txtSortEN.Text = ds.Tables[0].Rows[0][2].ToString(); TextBox2.Text = ds.Tables[0].Rows[0][3].ToString(); TextBox1.Text = ds.Tables[0].Rows[0][4].ToString(); this.DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByValue(ds.Tables[0].Rows[0][7].ToString())); } } private DataSet BindDDl() { string DDLSource = "select * from v3_m_category where visiable =1 or visiable =3 and ParentId = 0"; DataSet ds = new common().ExcuteReader(DDLSource); return ds; } protected void ImageButton2_Click(object sender, ImageClickEventArgs e) { Response.Redirect("SortMain.aspx"); } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { string sqlstr = "update v3_m_category set name_cn ='" + txtSortCN.Text.Trim() + "',name_en = '" + txtSortEN.Text.Trim() + "',descrip_cn='" + TextBox2.Text.Trim() + "',descrip_en ='" + TextBox1.Text.Trim() + "',titlebgi_en = '背景图中文版',titlebgi_cn = '背景图英文版',ParentId ="+ Convert.ToInt32(this.DropDownList1.SelectedItem.Value)+" where id = "+Request.QueryString["id"].ToString(); bool b = new common().ExcuteNoneQuery(sqlstr, null); if (b) { Methods1.Methods1.Alert(this, "修改成功!"); } else { Methods1.Methods1.Alert(this, "修改失败,请联系管理员!!"); } } protected void ImageButton3_Click(object sender, ImageClickEventArgs e) { txtSortCN.Text = null; txtSortEN.Text = null; TextBox2.Text = null; TextBox1.Text = null; } }