Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Highlighted
New Member
Posts: 6
Registered: ‎10-27-2011

Hyperlink

I am trying to have a button link to an external website along passing through the id of the main entity at the end of the hyperlink string.  Anyone have any ideas?

Highlighted
Bronze Super Contributor
Posts: 236
Registered: ‎03-30-2009

Re: Hyperlink

This depends on if you want to redirect the current site, or if you want to open a new window.  Either way, you would start be getting hte Id of the curent entity:

 

Sage.Entity.Interfaces.IMyEntity me = this.BindingSource.Current as Sage.Entity.Interfaces.IMyEntity;

 

// Redirect current window to new website

if (me != null)

   Response.Redirect("http://some.website.name?id=" + me.Id.ToString());

 

// Or - open a  new window using JavaScript (this assumes the name of your button is btnOpenWindow)

 ScriptManager.RegisterStartupScript(btnOpenWindow, btnOpenWindow.GetType(), "OpenNewWindow",

   "window.open('http://some.website.name?id=" + me.Id.ToString() + "');", true);

Mike LaSpina
Professional Services Consultant

Sage
8800 N Gainey Center Dr Ste 200
Scottsdale AZ 85258
Tel: 480-383-5344
Cell: 480-321-6637
Fax: 480-556-4090
mike.laspina@sage.com

Your Business in Mind.
Highlighted
New Member
Posts: 6
Registered: ‎10-27-2011

Re: Hyperlink

Sorry, but where do I put the Java script?

Highlighted
Bronze Super Contributor
Posts: 236
Registered: ‎03-30-2009

Re: Hyperlink

[ Edited ]

Either one would go on the click action of the button.  Also be sure that the declaration of Sage.Entity.Interfaces.I... is of the correct tytpe of Entity for the page you're working on.

Mike LaSpina
Professional Services Consultant

Sage
8800 N Gainey Center Dr Ste 200
Scottsdale AZ 85258
Tel: 480-383-5344
Cell: 480-321-6637
Fax: 480-556-4090
mike.laspina@sage.com

Your Business in Mind.
Highlighted
New Member
Posts: 6
Registered: ‎10-27-2011

Re: Hyperlink

OK, I want to do the one where it opens in a new window.... 

 

I pretty new at this (can you tell).  I see "On Click Action" and "on Client Click"

 

Could you point me the right direction to add the code to what property.  Much appreciated!!!

Highlighted
Bronze Super Contributor
Posts: 236
Registered: ‎03-30-2009

Re: Hyperlink

On Click Action - put a c# code snippet (osolete) with the 2 lines of code there.

Mike LaSpina
Professional Services Consultant

Sage
8800 N Gainey Center Dr Ste 200
Scottsdale AZ 85258
Tel: 480-383-5344
Cell: 480-321-6637
Fax: 480-556-4090
mike.laspina@sage.com

Your Business in Mind.
Highlighted
New Member
Posts: 6
Registered: ‎10-27-2011

Re: Hyperlink

Thanks so much.  I almost got it.  However it doesn't like the work "me"

I am trying to get the ticketid in there so would it go like:

 

ScriptManager.RegisterStartupScript(btnOpenWindow, btnOpenWindow.GetType(), "OpenNewWindow",

   "window.open('http://reportserver&ticketid=" + me.Id.ToString() + "');", true);

 

replace me with ticketid?

Highlighted
Bronze Super Contributor
Posts: 236
Registered: ‎03-30-2009

Re: Hyperlink

[ Edited ]

So,

 if you're working with a ticket, then your code would look like this:

 

        Sage.Entity.Interfaces.ITicket t = this.BindingSource.Current as Sage.Entity.Interfaces.ITicket;
        if (t!= null)
            ScriptManager.RegisterStartupScript(btnOpenWindow, btnOpenWindowGetType(), "OpenNewWindow", "window.open('http://reportserver&ticketid=" + t.Id.ToString() + "');", true);

Note that every entity's ID is 'Id' and the actual ID field is usually hidden in our ORM, so you would not be able to see the field TickedId.

Mike LaSpina
Professional Services Consultant

Sage
8800 N Gainey Center Dr Ste 200
Scottsdale AZ 85258
Tel: 480-383-5344
Cell: 480-321-6637
Fax: 480-556-4090
mike.laspina@sage.com

Your Business in Mind.