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

Add target="_Blank" to NavigateURL

11 Answers 100 Views
ImageGallery
This is a migrated thread and some comments may be shown as answers.
Michel
Top achievements
Rank 1
Michel asked on 08 Sep 2016, 12:50 AM

Hello,

I have the RadImageGallery implemented using the following:

<telerik:RadImageGallery ID="ImageGallery" RenderMode="Auto" runat="server" LoopItems="true" ShowLoadingPanel="true" AllowPaging="false" DisplayAreaMode="Image" OnNeedDataSource="ImageGallery_NeedDataSource" DataTitleField="ImageTitle" DataDescriptionField="ImageDescription" DataImageField="ImageURL"></telerik:RadImageGallery
         

the Code behind is like this:

Protected Sub ImageGallery_ItemDataBound(sender As Object, e As ImageGalleryItemEventArgs) Handles ImageGallery.ItemDataBound         Dim item As ImageGalleryItem = TryCast(e.Item, ImageGalleryItem)
   Dim db As New DBCorrDefense.DBDCDataContext()
   For Each item In ImageGallery.Items
     Dim EmData = db.CDSP_Get_URLByImageTitle(item.Title).FirstOrDefault
     If EmData Is Nothing Then
     Else
       item.NavigateUrl = EmData.URL
     End If
   Next
      db.Dispose()
      db = Nothing
End Sub

Protected Sub ImageGallery_NeedDataSource(sender As Object, e As Telerik.Web.UI.ImageGalleryNeedDataSourceEventArgs) Handles ImageGallery.NeedDataSource
 Dim db As New DBCorrDefense.DBDCDataContext()
ImageGallery.DataSource = db.CDSP_Get_AllSlides()
 End Sub

 

How is it possible to allow the NavigateURL to open in a new blank page when i click on the ImageItem? currently it is opening in the same page

Thanks

11 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 12 Sep 2016, 11:17 AM
Hello Mike,

I am afraid that the behavior you describe is not available out of the box.

By default when you define a NavigateUrl property for an item the window.location property is changed when the user clicks on the ImageArea. If you would like to change the behavior you would need to use custom logic.

You can override the mousedown event for the ImageArea. You can prevent the default logic and open the url manually in a new tab.

Regards,
Viktor Tachev
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Michel
Top achievements
Rank 1
answered on 18 Sep 2016, 02:04 PM

Hi Viktor,

Please, How can i do so if i don't have the get_navigateurl function?

 

Thanks

0
Viktor Tachev
Telerik team
answered on 21 Sep 2016, 11:26 AM
Hello Mike,

Note that the behavior is not supported by RadImageGallery our of the box. Thus, you would need to use custom logic to implement it.

One approach is to handle the mousedown event for the ImageArea element. Then, you can cancel the default event and implement your custom logic matching the specific requirements.


Regards,
Viktor Tachev
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Michel
Top achievements
Rank 1
answered on 23 Sep 2016, 02:05 PM

I am not sure we are on the same page Viktor.

How can i add or append target="_blank" to a imageitem from code-behind?

 

Thanks

0
Viktor Tachev
Telerik team
answered on 28 Sep 2016, 11:02 AM
Hi Mike,

In order to implement the behavior you would need to use custom client-side logic. Please examine the thread linked below that describes how you can implement similar behavior.



Regards,
Viktor Tachev
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Michel
Top achievements
Rank 1
answered on 11 Oct 2016, 06:03 PM

Dear Viktor,

All the ImageGallery is coming from the Database through dynamic code (even the target)

the example you provided is only on client side.

How to implement the same logic from code behind?

Thanks

0
Viktor Tachev
Telerik team
answered on 12 Oct 2016, 01:34 PM
Hello Mike,

You would need to use client-side logic in order to implement the behavior.

Alternatively , you can construct the complete RadImageGallery dynamically and use templates. In each template you should add the corresponding image with the link manually.

Check out the following resources that describe the templates in RadImageGallery in more detail:



Regards,
Viktor Tachev
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Michel
Top achievements
Rank 1
answered on 17 Oct 2016, 06:43 AM

Dear Viktor, please can you advise on this issue. It is not working not image is being displayed and i cannot get to add HTML content. below is my code

Thanks for your help

ascx:

<telerik:RadImageGallery ID="PresentationView_RadImageGallery" RenderMode="Auto" runat="server" LoopItems="true" ShowLoadingPanel="False" AllowPaging="false" DisplayAreaMode="Image" >
<ImageAreaSettings Height="350px" ResizeMode="Fill" /><ToolbarSettings Position="None" />
<ClientSettings AllowKeyboardNavigation="true"><AnimationSettings SlideshowSlideDuration="3000">
<NextImagesAnimation Type="CollapsingHorizontalStripes" Easing="Random" Speed="2500" /><PrevImagesAnimation Type="CollapsingVerticalStripes" Easing="Random" Speed="2500" /></AnimationSettings><br>                </ClientSettings></telerik:RadImageGallery>

 

code behind:

 

1.
Private Class ImageGalleryContentTemplate
    Public Property BackgroundImage() As [String]
        Get
            Return m_BackgroundImage
        End Get
        Set
            m_BackgroundImage = Value
        End Set
    End Property
    Private m_BackgroundImage As [String]
    Public Property HTMLTemplate() As [String]
        Get
            Return m_HTMLTemplate
        End Get
        Set
            m_HTMLTemplate = Value
        End Set
    End Property
    Private m_HTMLTemplate As [String]
 
    Public Sub InstantiateIn(container As Control)
        container.Controls.Add(New RadMediaPlayer())
    End Sub
End Class
 
Protected Sub Page_Init(sender As Object, e As EventArgs)
    Dim igItem As New ImageGalleryItem()
    igItem.ImageUrl = "/static/media/carousel/Dan_Zarate_Banner.png"
    PresentationView_RadImageGallery.Items.Add(igItem)
 
    Dim igti As New ImageGalleryTemplateItem()
    Dim template As New ImageGalleryContentTemplate()
    igti.ContentTemplate = template
    PresentationView_RadImageGallery.Items.Add(igti)
End Sub
0
Eyup
Telerik team
answered on 20 Oct 2016, 05:22 AM
Hi Mike,

For adding link elements in the description of the image gallery control you can check:
http://www.telerik.com/forums/description-box-00238fb8e723#yzWfE6Tyf0ifW3cTTp7Lgw

Additional samples which you may deem helpful you can find here:
http://www.telerik.com/support/code-library/aspnet-ajax/image-gallery

In addition, RadImageGallery is very similar to RadMediaPlayer control when creating programmatically:
http://demos.telerik.com/aspnet-ajax/media-player/examples/applicationscenarios/video-gallery/defaultcs.aspx
http://www.telerik.com/support/code-library/programmatic-creation-and-configuration-of-the-media-player-control


I hope this will prove helpful.

Regards,
Eyup
Telerik by Progress
Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
0
Michel
Top achievements
Rank 1
answered on 20 Oct 2016, 08:08 AM

Dear Eyup,

Thanks for your reply. the issue is that i want to add custom code based on Query results (i.e. target="_Blank",or target="_Parent" to the NavigateURL Field).

I am not sure why the code is not working with me.

I appreciate your help

Thanks

Mike

0
Viktor Tachev
Telerik team
answered on 25 Oct 2016, 07:49 AM
Hello Mike,

Please note that the behavior is not supported out of the box. Thus, implementing it would require custom solution that falls outside the scope of our standard support services.

If you would like to request the functionality to be added as a built-in feature please submit a request in the feedback portal.


In case you would like to have a custom function implemented for you I would recommend contacting our professional services team.



Regards,
Viktor Tachev
Telerik by Progress
Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
Tags
ImageGallery
Asked by
Michel
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Michel
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or