在给定表达式上格式化一排gridview [英] formatting a row of gridview over a given expression

查看:65
本文介绍了在给定表达式上格式化一排gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个臭名昭著.

我正在制作一个像黄页一样的网站,并希望向付费用户显示一种特殊的格式,例如特定的背景等.

需要建议.

Hi this is notorious.

I am making a website just like yellow pages and want to show a special formatting to the paid user like a specific background etc.

Need a suggestions.

推荐答案

使您的css类成为paidUserRow,并处理gridview的rowdatabound事件,并在rowdatabound中评估您的表达式后,为行更改css类.
make your css class for paidUserRow and handle rowdatabound event of gridview and change css class for row after evaluating your expression in rowdatabound.

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (e.Row.Cells[3].ToString() == "Paid")//Replace your condition here
            {
                e.Row.BackColor = Color.Blue;
            }
            else
            {
                //write code for unpaid row
            }

        }
    }


--Pankaj


--Pankaj


这篇关于在给定表达式上格式化一排gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆