62,268
社区成员
发帖
与我相关
我的任务
分享
public void BindData()
{
if (Request.QueryString["id"] != null)
{
BindNewsKind();
int NewsId = Convert.ToInt32(Request.QueryString["id"]);
News SingleNews = new News();
SingleNews = News.GetNewsByNewsId(NewsId);
this.TxtNewsTitle1.Text = SingleNews.NewsTitle;
this.DropNewsKinds1.SelectedIndex = SingleNews.NewsKindId;
this.WebNewsBody1.Text = SingleNews.NewsBody;
}
}Convert.ToInt32(Request.QueryString["id"]),取值没问题,但是就是无法赋值给NewsId,NewsId为空。很奇怪的是this.TxtNewsTitle1.Text = SingleNews.NewsTitle;竟然能赋值
public void BindData()
{
if (Request.QueryString["id"] != null)
{
BindNewsKind();
//int NewsId = Convert.ToInt32(Request.QueryString["id"]);
News SingleNews = new News();
SingleNews = News.GetNewsByNewsId(Convert.ToInt32(Request.QueryString["id"]));
this.TxtNewsTitle1.Text = SingleNews.NewsTitle;
this.DropNewsKinds1.SelectedIndex = SingleNews.NewsKindId;
this.WebNewsBody1.Text = SingleNews.NewsBody;
}
}this.TxtNewsTitle1.Text = SingleNews.NewsTitle;可以赋值了,但是this.WebNewsBody1.Text = SingleNews.NewsBody又不能了
public void BindData()
{
int NewsId = 0;
if(int.TryParse(Request.QueryString["id"], out NewsId))
{
BindNewsKind();
News SingleNews = new News();
SingleNews = News.GetNewsByNewsId(NewsId);
this.TxtNewsTitle1.Text = SingleNews.NewsTitle;
this.DropNewsKinds1.SelectedIndex = SingleNews.NewsKindId;
this.WebNewsBody1.Text = SingleNews.NewsBody;
}
}
public void BindData()
{
int NewsId = 0;
int.TryParse(Request.QueryString["id"], out NewsId);
BindNewsKind();
News SingleNews = new News();
SingleNews = News.GetNewsByNewsId(NewsId);
this.TxtNewsTitle1.Text = SingleNews.NewsTitle;
this.DropNewsKinds1.SelectedIndex = SingleNews.NewsKindId;
this.WebNewsBody1.Text = SingleNews.NewsBody;
}