using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Telerik.Web.UI; namespace VRS.Management { public partial class Step : BasePage { DataService.BLL.admin_log log = new DataService.BLL.admin_log(); DataService.BLL.pro_first_cooper bll_cooper = new DataService.BLL.pro_first_cooper(); protected override void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataLoad(); } } protected void DataLoad() { string Id = Request.Params["Id"]; if (Id == "first_cooper") { object list = bll_cooper.GetModelList("").OrderBy(s => s.pos).ToList(); RadListBoxDestination.DataSource = list; RadListBoxDestination.DataValueField = "id"; RadListBoxDestination.DataTextField = "cooper_name"; RadListBoxDestination.DataBind(); } } protected void btnSure_Click(object sender, EventArgs e) { string Id = Request.Params["Id"]; var items = RadListBoxDestination.Items; var list_text = new List(); var list_value = new List(); foreach (var item in items) { var obj = item as Telerik.Web.UI.ControlItem; list_text.Add(obj.Text); list_value.Add(obj.Value); } var table = ""; var key = ""; var postion = "pos"; if (Id == "first_cooper") { table = "pro_first_cooper"; key = "id"; } if (!string.IsNullOrEmpty(table)) { var flag = log.update_position(table, key, postion, list_value); if (flag) { RadAjaxManager1.ResponseScripts.Add("alert('保存成功!');CloseAndRebind();"); } else { RadAjaxManager1.ResponseScripts.Add("alert('保存失败!');"); } } } protected void RadListBoxDestination_Reordered(object sender, RadListBoxEventArgs e) { RadListBoxDestination.DataBind(); } } }