Пример #1
0
    /// <summary>
    /// The Click event is raised when the "Search" Button control is clicked.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        IsSearchEnabled = true;

        ReviewAdmin reviewAdmin = new ReviewAdmin();
        TList<Review> reviewList = reviewAdmin.GetAll();

        string sqlQuery = "subject like '*" + ReviewTitle.Text.Trim() + "*'";
        sqlQuery += " and CreateUser like '*" + Name.Text.Trim() + "*'";

        //Review status
        if (ListReviewStatus.SelectedValue != "0")
        {
            sqlQuery += " and Status = '" + ListReviewStatus.SelectedValue + "'";
        }

        if (ddlProductNames.SelectedValue != "0")
        {
            sqlQuery += " and ProductId = " + ddlProductNames.SelectedValue;
        }

        if (reviewList != null)
        {
            //Apply filter - it will force the filtering of the review collection,based on the filter expression
            reviewList.Filter = sqlQuery;

            //Apply sort
            reviewList.Sort("ReviewID desc");

            //save in ViewState
            ViewState["ReviewList"] = reviewList;

            uxGrid.DataSource = reviewList;
            uxGrid.DataBind();
        }
    }
Пример #2
0
    /// <summary>
    /// Bind grid
    /// </summary>
    private void Bind()
    {
        ReviewAdmin reviewAdmin = new ReviewAdmin();
        TList<Review> reviewList = reviewAdmin.GetAll();

        //Apply sort
        if (reviewList != null)
        {
            reviewList.Sort("ReviewID desc");
        }

        uxGrid.DataSource = reviewList;
        uxGrid.DataBind();
    }