This is a migrated thread and some comments may be shown as answers.

Add image in GridDataItem in databound event of RAD Grid

2 Answers 157 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ravi Kumar Kamboj
Top achievements
Rank 1
Ravi Kumar Kamboj asked on 04 Dec 2010, 03:04 PM
Hi,
Thanks in advance,
basically I m using my own controls which are inherited by RAD controls .
And Now i m using my first column as a client setting checkbox.
now my requiremnt is little bit change and now I want that i m using same my own grid but in that grid there is issue
when i m going to replace that checkBox in side the ClientSettingCheckBox type column to another controls that is simple "Imgae" in obly two rows but I have no solution that how I'll do this..

Please suggest me...

Thanks Regards,
Ravi Kumar Kamboj
Developer

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 06 Dec 2010, 05:39 AM
Hello Ravi,

Check out the following sample code to achieve this.

ASPX:
<telerik:GridClientSelectColumn UniqueName="GridClientSelectColumn">
</telerik:GridClientSelectColumn>

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
   {
     if (e.Item is GridDataItem)
       {
           GridDataItem item = (GridDataItem)e.Item;
           if (// your condition)
           {
               item["GridClientSelectColumn"].Controls.Clear();
               Image img = new Image();
               img.ImageUrl = "~/Images/Bitmap1.gif";
               item["GridClientSelectColumn"].Controls.Add(img);
           }
       }
   }

Thanks,
Princy.
0
Ravi Kumar Kamboj
Top achievements
Rank 1
answered on 06 Dec 2010, 06:04 AM
Thanks,
 Its working very well and it is very use full for us..


Regards
Ravi Kumar Kamboj
Developer
Tags
Grid
Asked by
Ravi Kumar Kamboj
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Ravi Kumar Kamboj
Top achievements
Rank 1
Share this question
or