We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Force link to open in a new tab using target=_blank

Hi, I am using the following vb.net code to populate a submenu item (which works properly) but it does not open a link in a new tab. How do I do this using target=_blank ?

Dim oMenuItem As Syncfusion.JavaScript.Web.MenuItem


conn.ConnectionString = AccessConnect


myCommand.Connection = conn

sSql = "SELECT * FROM Links"

myCommand.CommandText = sSql

myReader = myCommand.ExecuteReader

If myReader.HasRows Then

While myReader.Read()

oMenuItem = New Syncfusion.JavaScript.Web.MenuItem

oMenuItem.Text = myReader.Item(2).ToString

oMenuItem.Url = myReader.Item(1).ToString

oMenuItem.HtmlAttributes = ""

'oMenuItem.LinkAttributes.Insert(0, "target=_blank") <--- this does not work so is commented out


End While


oMenuItem = New Syncfusion.JavaScript.Web.MenuItem

oMenuItem.Text = "*** No Skittles Links Found ***"


End If


myReader = Nothing




Many thanks for your help, John

1 Reply 1 reply marked as answer

SS Sivakumar ShunmugaSundaram Syncfusion Team December 27, 2022 12:56 PM UTC

Hi John,

Greetings from Syncfusion support.

To open a link in a new tab using our Menu component, you can use the LinkAttributes attribute as follows:

Refer to the below code snippet.



<ej:Menu ID="weblink" Width="600" runat="server">




        <ej:MenuItem Id="searchengine" Text="Search engine">




               <ej:MenuItem Text="Bing" Url=http://www.bing.com/ LinkAttributes="target:'_blank'"></ej:MenuItem>






                <ej:MenuItem Text="Google" Url=https://www.google.co.in/ LinkAttributes="target:'_blank'"></ej:MenuItem>






                <ej:MenuItem Text="Yahoo" Url=http://in.yahoo.com/ LinkAttributes="target:'_blank'"></ej:MenuItem>









This attribute allows you to define the target of the link, in this case, a new tab.

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/WebApplication1344589319.zip

Check out the attached sample for your reference.

Marked as answer
Live Chat Icon For mobile
Up arrow icon