protected void Page_Load(object sender, EventArgs e) { //获取要查看的新闻ID int id = Convert.ToInt32(Request.QueryString["id"]); Msg = NewsEventsHelper.GetNews(id); }
protected void Page_Load(object sender, EventArgs e) { try { int id = Convert.ToInt32(Request.QueryString["id"].ToString()); news = new News(); news = NewsEventsHelper.GetNews(id); } catch { } }
/// <summary> /// 用于向 News EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet<T> 属性的 .Add 方法。 /// </summary> public void AddToNews(News news) { base.AddObject("News", news); }
/// <summary> /// 创建新的 News 对象。 /// </summary> /// <param name="nid">Nid 属性的初始值。</param> /// <param name="title">Title 属性的初始值。</param> /// <param name="content">Content 属性的初始值。</param> /// <param name="postTime">PostTime 属性的初始值。</param> /// <param name="isPicNews">IsPicNews 属性的初始值。</param> /// <param name="isLoopPicNews">IsLoopPicNews 属性的初始值。</param> public static News CreateNews(global::System.Int64 nid, global::System.String title, global::System.String content, global::System.DateTime postTime, global::System.Boolean isPicNews, global::System.Boolean isLoopPicNews) { News news = new News(); news.Nid = nid; news.Title = title; news.Content = content; news.PostTime = postTime; news.IsPicNews = isPicNews; news.IsLoopPicNews = isLoopPicNews; return news; }