I am trying to do a foreach loop through every Radgrid row. If the column value is an 'N' I change the image icon, if it is a 'P' I change the ImageURL to point to another Icon.
Unfortunately I have tried a few things but I cannot get the strTranslationValue
Column value.
How is it done?
List<AppFile> fileList = GetFileList();
grdFiles.DataSource = fileList != null ? fileList : (object)string.Empty;
grdFiles.PageSize = fileList.Count;
grdFiles.DataBind();
foreach (GridDataItem item in grdFiles.Items)
{
string strTranslationValue = item.GetDataKeyValue("sComment").ToString();
Image iconComment = (Image)item.FindControl("translationImg");
iconComment.ImageUrl = "~/images/approved_icon.png";
}
Update: Trying to use ItemDataBound event..
protected void grdFiles_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item.DataItem is AppFile) {
GridItem gItem = (GridItem)e.Item;
string strTranslationValue = gItem["sComments"].Text;
}
}