How to change in a Gridview on RowDataBound event the value of an Eval() field

强颜欢笑 提交于 2019-12-01 17:48:32
If e.Row.Cells(3).Text <> Boolean.FalseString Then
       e.Row.Cells(3).Text = "Enabled"
Else
       e.Row.Cells(3).Text = "Disabled"
End If
Cem Kandemir

Same problem with me.

e.Row.Cells[i].Text was empty. I think the data is not bound at the time which is somehow weird since we are in RowDataBound event.

However, I used:

     DataRowView drv = (DataRowView) e.Row.DataItem;
     if (drv["RNID"].ToString() == "")
     {
        e.Row.Visible = false;
     }

where "RNID" is one of the column names in my application. This solved my problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!