Setting image for GridImageColumn in ItemDataBound Codebehind

by ebarcza 3/15/2012 12:20:00 PM
    protected void rgDeals_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            CheckBox chkDealLocked = (CheckBox)e.Item.FindControl("chkDealLocked");
            CheckBox chkComponentsLocked = (CheckBox)e.Item.FindControl("chkComponentsLocked");
 
            DataRowView drv = (DataRowView)e.Item.DataItem;
            int missingVolDays = Convert.ToInt32(drv["MissingVolumeDays"].ToString());
            
            GridDataItem item = (GridDataItem)e.Item;  
            Image img = (Image)item["Actualized"].Controls[0];
           
            if (missingVolDays != 0)
            {
                img.Visible = false;
                chkDealLocked.Enabled = false;
                chkComponentsLocked.Enabled = false;
            }
            else
            {
                img.ImageUrl = "~/Images/checkmark_blue.gif " ; 
                chkDealLocked.Enabled = true;
                chkComponentsLocked.Enabled = true;
            }
 
        }
    }

Tags:

.NET | Telerik

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About the author

Name of author Author name
Something about me and what I do.

E-mail me Send mail

Calendar

<<  July 2018  >>
MoTuWeThFrSaSu
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345

View posts in large calendar

Recent comments

Tags

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2018

Sign in