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();

    }

}

 

你可能感兴趣的:(toString)