Ejemplo n.º 1
0
    protected void DataBindGridViewAllWords()
    {
        lblResult.Text = null;
        System.Data.Objects.ObjectParameter total = new System.Data.Objects.ObjectParameter("total", typeof(int));

        string keywords = null;

        if (txtSearch.Text != "")
        {
            keywords = txtSearch.Text;
        }
        int language     = Int32.Parse(ddlLanguage.SelectedValue);
        int searchMethod = Int32.Parse(ddlSearchMethod.SelectedValue);
        List <DictionaryModel.GetSearchedWord_Result> ddd = entities.GetSearchedWord(language, searchMethod, keywords, SortingColumn, SortingDirection == "sortingasc" ? "ASC" : "DESC", total, base.StartRow, base.PageSize).ToList();

        GridViewAllWords.DataSource = entities.GetSearchedWord(language, searchMethod, keywords, SortingColumn, SortingDirection == "sortingasc" ? "ASC" : "DESC", total, base.StartRow, base.PageSize);
        GridViewAllWords.DataBind();

        if ((int)total.Value == 0)
        {
            pnlNoFound.Visible = true;
        }
        else
        {
            pnlNoFound.Visible = false;
        }

        base.TotalRows     = (int)total.Value;
        lblTotalWords.Text = "Брой: " + total.Value.ToString();
    }
    protected void DataBindRepeaterSearch()
    {
        pnlEnterWord.Visible = pnlNoFound.Visible = false;
        System.Data.Objects.ObjectParameter total = new System.Data.Objects.ObjectParameter("total", typeof(int));

        if (txtSearch.Text != "")
        {
            keywords = txtSearch.Text;
        }

        int searchMethod = Int32.Parse(ddlSearchMethod.SelectedValue);
        int languageId   = Int32.Parse(ddlLanguage.SelectedValue);

        rptSearchResult.DataSource = entities.GetSearchedWord(languageId, searchMethod, keywords, SortingColumn, SortingDirection == "sortingasc" ? "ASC" : "DESC", total, base.StartRow, base.PageSize);
        rptSearchResult.DataBind();

        if ((int)total.Value > 20)
        {
            pnlPagingTop.Visible = pnlPaigingBottom.Visible = true;
            base.TotalRows       = (int)total.Value;
        }
        else
        {
            pnlPagingTop.Visible = pnlPaigingBottom.Visible = false;
        }
        lblResultCount.Visible = true;

        if (searchMethod == 2)
        {
            lblResultCount.Visible = false;
            pnlPagingTop.Visible   = pnlPaigingBottom.Visible = false;
        }

        lblResultCount.Text = "Съвпадения: " + total.Value.ToString();
    }