ASP.NET-ページ転送値Request.QuerString[].ToString();

665 ワード

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

    }

}