protected void Page_Init(object sender, EventArgs e) { if (Session["webmenu"] == null) { object menu = Unitlib.Get_menu(); Session["webmenu"] = menu; } }
protected void Btn_save_Click(object sender, System.EventArgs e) { //----------------------------------------------------------------------- if (Btn_save.CommandArgument == "add") { strsql = " insert into tbl_category( parentid, classId, sort, status, title, createdate, createuserid,kind,pagename) values "; strsql += "(@parentid, @classId, @sort, @status, @title, getdate(), '" + Session["userid"].ToString() + "',@kind,@pagename) "; } else { strsql = "update tbl_category set parentid=@parentid,sort=@sort,status=@status, title=@title"; strsql += ",kind=@kind,pagename=@pagename where categoryid =@categoryid"; } SqlConnection conn = new SqlConnection(classlib.dbConnectionString); SqlCommand cmd = new SqlCommand(); conn.Open(); cmd = new SqlCommand(strsql, conn); cmd.Parameters.Add("parentid", SqlDbType.NVarChar).Value = DropDownList2.SelectedValue; cmd.Parameters.Add("classId", SqlDbType.NVarChar).Value = classid; cmd.Parameters.Add("sort", SqlDbType.NVarChar).Value = sort.Text; cmd.Parameters.Add("status", SqlDbType.NVarChar).Value = status.SelectedValue; cmd.Parameters.Add("title", SqlDbType.NVarChar).Value = class_name.Text; cmd.Parameters.Add("kind", SqlDbType.NVarChar).Value = kind.SelectedValue; cmd.Parameters.Add("pagename", SqlDbType.NVarChar).Value = pagename.Text; if (Btn_save.CommandArgument == "add") { } else { cmd.Parameters.Add("categoryid", SqlDbType.VarChar).Value = Selected_id.Value; } cmd.ExecuteNonQuery(); cmd.Dispose(); conn.Close(); MultiView1.ActiveViewIndex = 0; cleaninput(); selectSQL(); Session["webmenu"] = Unitlib.Get_menu(); }
public object Getwebmenu() { return(Unitlib.Get_menu()); // string result = JsonConvert.SerializeObject(hotlist); }