Group Link to New Page

rated by 0 users
Answered (Verified) This post has 1 verified answer | 3 Replies | 2 Followers

Top 500 Contributor
100 Posts
Points 1,470
grsengr posted on Fri, Nov 21 2008 11:49 AM

I've added a new page to hubs\[mytheme]\calendar-main.aspx and I need to add a link to the sidebar (where the Home, Blogs, Discussions, etc. links are for the group) to get to this new page.

I've added a new url in SiteUrls.config under the hubs location that looks like this:

<url name="hub_calendar" path="##hubdirectory##calendar/default.aspx" pattern="##hubName##/calendar/default.aspx" vanity="{2}?App=${{app}}" physicalPath="##hubThemeDir## page="calendar-main.aspx" applicationType="calendar" />

I added a SiteUrl control to the Themes/Hubs/[mytheme]/theme.Master page that looks like this:

<CSControl:SiteUrl UrlName="hub_calendar" ResourceName="calendar" runat="server" Tag="LI" />

A link shows up where I want it and it tries to link to the correct page, but it is missing the "hubName" part. So the link is basically this: http://[root]/cs/groups//calendar/default.aspx. How can I get it to pick up the hubName correctly so the link will show up?

Thanks

-Glen

  • | Post Points: 5

Answered (Verified) Verified Answer

Top 100 Contributor
Male
242 Posts
Points 3,710
Partners
Verified by grsengr

Try this.  You won't need your SetLink code anymore, I believe.

<CSControl:SiteUrl runat="server" UrlName="hub_calendar" ResourceName="Calendar" Tag="LI">
  <Parameter1Template>
    <CSHub:HubData runat="server" Property="ApplicationKey" />
  </Parameter1Template>
</CSControl:SiteUrl>

John Bledsoe

Sr. Software Specialist - ATGi

  • | Post Points: 20

All Replies

Top 500 Contributor
100 Posts
Points 1,470
grsengr replied on Fri, Nov 21 2008 12:16 PM

I've found a hacky way to do it, but I'd still rather do it the "correct" way if someone can help me out.

To get it working I put an asp:Hyperlink in place of the SiteUrl control. I then added a method "SetLink" that looks like this:

protected void SetLink(){
string baseUrl = CommunityServer.Components.CSContext.Current.SiteUrl;
StringBuilder url = new StringBuilder("http://");
url.Append(baseUrl);
if (!baseUrl.EndsWith("cs")) url.Append("/cs");
url.AppendFormat("/groups/{0}/calendar/default.aspx", HubControlUtility.Instance().GetCurrentHub(this).Name);
myHyperlink.NavigateUrl = url.ToString();
}

It works, but it's a hacky way to have to do it.

-Glen

  • | Post Points: 20
Top 100 Contributor
Male
242 Posts
Points 3,710
Partners
Verified by grsengr

Try this.  You won't need your SetLink code anymore, I believe.

<CSControl:SiteUrl runat="server" UrlName="hub_calendar" ResourceName="Calendar" Tag="LI">
  <Parameter1Template>
    <CSHub:HubData runat="server" Property="ApplicationKey" />
  </Parameter1Template>
</CSControl:SiteUrl>

John Bledsoe

Sr. Software Specialist - ATGi

  • | Post Points: 20
Top 500 Contributor
100 Posts
Points 1,470

John Bledsoe:

Try this.  You won't need your SetLink code anymore, I believe.

<CSControl:SiteUrl runat="server" UrlName="hub_calendar" ResourceName="Calendar" Tag="LI">
  <Parameter1Template>
    <CSHub:HubData runat="server" Property="ApplicationKey" />
  </Parameter1Template>
</CSControl:SiteUrl>

Perfect! That's exactly what I needed.

Thanks for the help Mr. Bledsoe.

-Glen

  • | Post Points: 5
Page 1 of 1 (4 items) | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com