ASP.NET - 页面传值 Request.QuerString[].ToString();

public partial class WebForm2 : System.Web.UI.Page
{
    BLL.CategoryBLL categorybll = new CategoryBLL();
    BLL.NewsBLL newsbll = new NewsBLL();
    //接收分类ID
    string NewsId = string.Empty;

    protected void Page_Load(object sender, EventArgs e)
    {
        //接收分类ID
        NewsId = Request.QueryString["id"].ToString();

        if (!Page.IsPostBack)
        {
            datasourcebind();
        }
    }

    public void datasourcebind()
    {
        //根据类别ID取出新闻
        this.rep_allnews.DataSource = newsbll.SelectNewsToCategoryId(NewsId);
        this.rep_allnews.DataBind();
    }
}

 

posted on 2015-07-08 14:01  ultrastrong  阅读(315)  评论(0编辑  收藏  举报