private void InitControls() { List <cmsLinkGroup> types = LinkGroupService.GetInstance().GetList(CurrentLanguageId, 1); ddlType.DataTextField = "Name"; ddlType.DataValueField = "Id"; ddlType.DataSource = types; ddlType.DataBind(); ddlType.Items.Insert(0, new ListItem("默认", "0")); }
private void DoLinkTypeActions(string action) { LinkGroupService lts = LinkGroupService.GetInstance(); if (action.Equals("LinkGroupOrder")) { string id = Request["Id"]; string order = Request["Order"]; int r = lts.ChangeOrder(id, int.Parse(order)); if (r > 0) { json = "{\"result\":1}"; } else { json = "{\"result\":0, \"msg\":\"服务器发生错误,排序失败!\"}"; } } else if (action.Equals("LinkGroupEnable")) { string id = Request["Id"]; int r = lts.Enable(id); if (r > 0) { json = "{\"result\":1}"; } else { json = "{\"result\":0, \"msg\":\"服务器发生错误,状态改变失败!\"}"; } } else if (action.Equals("LinkGroupDelete")) { string id = Request["Id"]; int r = lts.Delete(id); if (r > 0) { json = "{\"result\":1}"; } else { json = "{\"result\":0, \"msg\":\"服务器发生错误,删除失败!\"}"; } } }
protected void Page_Load(object sender, EventArgs e) { // 初始化分页控件和数据绑定控件 base.InitializePageControls(pager, gv); if (!IsPostBack) { ddlType.DataTextField = "Name"; ddlType.DataValueField = "Id"; ddlType.DataSource = LinkGroupService.GetInstance().GetList(CurrentLanguageId, 1); ddlType.DataBind(); ddlType.Items.Insert(0, new ListItem("默认", "0")); ddlType.Items.Insert(0, new ListItem("--请选择--", "-1")); BindGrid(); } }