Conditional output in cell based on row data in Gridview's RowDataBound event

后端 未结 3 352
后悔当初
后悔当初 2021-01-12 22:45

i have a bit value (Black) i want to display its status in gridview as if its true, the row display \"Yes\", otherwise the row display \"No\", this is my code, but the resul

3条回答
  •  借酒劲吻你
    2021-01-12 23:34

    I don't know your datasource, but if you can evaluate it, do something like this:

    
                
                
                        <%# GetBit(Eval("BlackBit"))%>
                
    
    

    And code-behind:

    private string GetBit(object objBit)
    {
        if (Convert.ToInt32(objBit) == 1)
        {
            return "Yes";
        }
        return "No";
    }
    

提交回复
热议问题