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

executing javascript from a GridHyperLinkColumn

2 Answers 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Miguel
Top achievements
Rank 1
Miguel asked on 09 Dec 2016, 08:53 PM

Hi,

I'm porting some old code to Telerik and I'm having issues. This application has a grid and two of the columns contains hyperlinks that would execute java code to open a non-modal windows to present more details on the items with hyperliks
In the old code, this solved by a template like this:

<ItemTemplate>
              <asp:HyperLink ID="hplnkCatalogDetails" runat="server" ToolTip='Click To View Details'    Text='<%# Eval("ID") %>' NavigateUrl="<%#String.Format(&quot;javascript:void(window.showModalDialog('CatalogDetailsPopUp.aspx?id={0}','','dialogHeight:500px;dialogWidth:850px'));&quot;, Eval(&quot;ID&quot;)) %>" />                                                
</ItemTemplate>

 

However this solution fails to execute if using this solution with Telerik GridTemplateColumn :

<telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column" HeaderText="Catalog" UniqueName="TemplateColumn" DataField="ID">
                                                        <ItemTemplate>
                                                          <asp:HyperLink ID="hplnkCatalogDetails2" runat="server" ToolTip='Click To View Details'
                                                                    Text='<%# Eval("ID") %>' NavigateUrl="<%#String.Format(& quot;javascript:void(window.showModalDialog     ('CatalogDetailsPopUp.aspx?id={0}','','dialogHeight:500px;dialogWidth:850px'));&quot;, Eval(&quot;ID&quot;)) %>" />
                                                        </ItemTemplate>
                                                    </telerik:GridTemplateColumn>

 

and this other approach does not work neither using GridHyperLinkColumn:

                                                   
                                                    <telerik:GridHyperLinkColumn AllowSorting="False" DataTextField="ID" FilterControlAltText="Filter column column" HeaderText="Catalog" UniqueName="colID"
                                                      
                                                        NavigateUrl= "&quot;<%#String.Format(& quot;javascript:void(window.showModalDialog('CatalogDetailsPopUp.aspx?id={0}','','dialogHeight:500px;dialogWidth:850px'));&quot;, Eval(&quot;ID&quot;)) %>&quot;"
                                                        DataNavigateUrlFields="ID"
                                                        DataNavigateUrlFormatString="javascript:void(window.showModalDialog('CatalogDetailsPopUp.aspx?id={0}','','dialogHeight:500px;dialogWidth:850px'))" >
                                                       
                                                    </telerik:GridHyperLinkColumn>

 

How should I address this?

 

 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Eyup
Telerik team
answered on 14 Dec 2016, 01:02 PM
Hi Miguel,

Generally, this requirement should be possible with GridTemplateColumn. You can check various ways of declaring link columns in the RadGrid web site provided in the following post:
http://www.telerik.com/forums/open-report-link-using-unique-row-id#eupACGJdv0mBbLYsQEvMdQ

And here you can find a list of possible dialog options:
http://www.telerik.com/forums/context-menu---open-a-pop-up#Qe9fJgzWrE2DhYPWX7OkCQ

As stated, this implementation can be achieved using GridTemplateColumn. Check once again the definition and try to build the ItemTemplate step by step.

Regards,
Eyup
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Miguel
Top achievements
Rank 1
answered on 14 Dec 2016, 02:27 PM
Thanks, I found in how to properly doing it with the template column.
Tags
Grid
Asked by
Miguel
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Miguel
Top achievements
Rank 1
Share this question
or