public void sortBind() { var list = new NewsSortMgr().Select(); ddlSort.Items.Add("全部"); foreach (var item in list) { var listItem = new ListItem(item.NewsSortName, item.ID.ToString()); ddlSort.Items.Add(listItem); } }
public void newsBind() { var list = new NewsSortMgr().Select(); StringBuilder aa = new StringBuilder(); foreach (var i in list) { var href = "NewsTitle.aspx?id=" + i.ID; aa.AppendLine("<li>" + "<a href='" + href + "'>" + i.NewsSortName + "</a>" + "</li>"); sortList.InnerHtml = aa.ToString(); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string sortName = Convert.ToString(context.Request["SortName"]); NewsSort model = new NewsSort { NewsSortName = sortName }; var newsList = new NewsSortMgr().Select2(model); string jsonStr = new JavaScriptSerializer().Serialize(newsList); context.Response.Write(jsonStr); }