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

Display image in a specific Cell of RAD Grid

2 Answers 136 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mohsinjk jk
Top achievements
Rank 1
mohsinjk jk asked on 14 Jul 2010, 03:09 PM
Hi,

I am working with RAD Grid control, I want to display a small image inside a cell,
when i press a 'itemtamplate button' I just want to display a image in specific cell, 

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 15 Jul 2010, 08:32 AM
Hello Mohsinjk,

The code for a similar scenario is shown below. I used GridTemplateColumn to show the image and I set the Visibility to "False" initially. When clicking on the button, get reference to corresponding image control and set the Visiblity to True. I hope this code will best suit for you.

ASPX:
<telerik:GridTemplateColumn>
     <ItemTemplate>
        <asp:Button ID="Button3" CommandName="Click" runat="server" Text="Button" />
     </ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn>
      <ItemTemplate>
        <asp:Image ID="Image1" runat="server" Visible="false" ImageUrl="~/Images/Filter.gif" />
      </ItemTemplate>
 </telerik:GridTemplateColumn>

C#:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
   {
      if (e.CommandName == "Click")
       {
           e.Item.FindControl("Image1").Visible = true;
       }
   }

Please post again if you need futher help in this.

Thanks,
Princy.
0
mohsinjk jk
Top achievements
Rank 1
answered on 15 Jul 2010, 10:13 AM
Thanks dude.
Tags
Grid
Asked by
mohsinjk jk
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
mohsinjk jk
Top achievements
Rank 1
Share this question
or