コード例 #1
0
    protected void ArticlesGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            var article = new Article(Convert.ToInt32(e.Row.Cells[0].Text));

            e.Row.Cells[1].Text = InputChecker.HtmlPartialDecode(article.Title);
            e.Row.Cells[2].Text = article.GetCategory().Text;
            e.Row.Cells[4].Text = String.Format("<img src='Images/Flags/{0}.png'/> {1}", article.Geolocation.ToLower(),
                                                CountryManager.GetCountryName(article.Geolocation));

            e.Row.Cells[6].Text = Money.Parse(e.Row.Cells[6].Text).ToString();
            e.Row.Cells[7].Text = HtmlCreator.GetColoredStatus(article.Status);

            if (article.Status != AdvertStatus.Paused)
            {
                e.Row.Cells[8].Text = "&nbsp;";
            }

            if (article.Status != AdvertStatus.Active)
            {
                e.Row.Cells[9].Text = "&nbsp;";
            }

            //Edit button
            ((LinkButton)e.Row.Cells[11].FindControl("ImageButton4")).ToolTip = U5007.EDIT;
        }
        else if (e.Row.RowType == DataControlRowType.Header)
        {
            e.Row.Cells[5].Text = U6012.READS;
            e.Row.Cells[6].Text = U6012.MONEYCREDITED;
        }
    }