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

How to open a popup or radwindow on click on telerik:GridImageColumn

5 Answers 503 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Akki
Top achievements
Rank 1
Akki asked on 13 Feb 2012, 02:42 PM
Hi,
I have scenario where i need to have  <telerik:GridImageColumn > inside rad grid. On click of this image i need to open radwindow or any .aspx.
How can i achieve this functionality.Below is the sample code.
 
     <telerik:RadGrid ID="rdGrdBudgetAssignment" runat="server" AllowPaging="true" AllowSorting="true" AutoGenerateColumns="false" PageSize="20"
     GridLines="None" Width="95%">
     <PagerStyle Mode="NextPrevAndNumeric" />
     <MasterTableView AllowPaging="true" AllowSorting="true" AllowFilteringByColumn="true" CommandItemDisplay="Top">
      <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true" />
      <CommandItemSettings ExportToExcelText="Export To Excel" ShowExportToExcelButton="true" ShowAddNewRecordButton="false" ShowRefreshButton="false" />
      <Columns>
      <telerik:GridImageColumn ImageUrl ="../Images/SortAsc.gif"></telerik:GridImageColumn>
      <telerik:GridImageColumn ImageUrl="../Images/SortDesc.gif"></telerik:GridImageColumn>
      </Columns>
     </MasterTableView>
      <ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true"  >
     <Resizing AllowColumnResize="true" />
     </ClientSettings>
     </telerik:RadGrid>

Regards,
Akki

5 Answers, 1 is accepted

Sort by
0
Accepted
Casey
Top achievements
Rank 1
answered on 13 Feb 2012, 03:26 PM
Hi Akki,

I would suggest changing the GridImageColumn to a GridButtonColumn with a button type of ImageButton. Then when the user clicks on the Image, you can use the RadGrid's ItemCommand event to open the RadWindow.

<telerik:GridButtonColumn UniqueName="SortAsc" ImageUrl ="../Images/SortAsc.gif" ButtonType="ImageButton" CommandName="SortAsc">
</telerik:GridButtonColumn>

I hope this helps!
Casey
0
Accepted
Princy
Top achievements
Rank 2
answered on 13 Feb 2012, 03:33 PM
Hello,

Try the following code snippet.
C#:
protected void rgLedgerInfo_ItemDataBound(object sender, GridItemEventArgs e)
   {
       if (e.Item is GridDataItem)
       {
           GridDataItem itm = (GridDataItem)e.Item;
           itm["Image"].Attributes.Add("onclick", "test();");
       }
   }
JS:
<script type="text/javascript">
 function test()
  {
     window.radopen("", null);
  }
</script>

Thanks,
Princy.
0
Akki
Top achievements
Rank 1
answered on 13 Feb 2012, 06:34 PM
Thanks Casey, it did work, but i would like to know the use of GridImageColumn so that i can use this in proper place.

Regards,
Akki
0
Akki
Top achievements
Rank 1
answered on 13 Feb 2012, 06:35 PM
Princy,
Your code worked too., thanks a lot .

Regards,
Akki
0
Casey
Top achievements
Rank 1
answered on 13 Feb 2012, 06:53 PM
I'm assuming that the GridImageColumn's intended use would be to display pictures of products. The documentation doesn't specify what the intended use of this column type is though. In the column types demo Telerik is displaying pictures of employees. 

RadGrid Column Types - Documentation

RadGrid Column Types - Demo

Tags
Grid
Asked by
Akki
Top achievements
Rank 1
Answers by
Casey
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Akki
Top achievements
Rank 1
Share this question
or