Using page selector in widget designer to set external URL
Objective:
I want to allow users to select a page from sitemap. When the widget renders on public side, the selected page's URL is used to provide a hyperlink to that page. In addition, I would like to allow users to provide an external link, if they so wish.
What I have done so far:
In my widget, I have a guid field for selected page.
public
Guid PageID
get
;
set
;
<
sf:PagesSelector
runat
=
"server"
ID
=
"pageSelectorPageID"
AllowExternalPagesSelection
=
"false"
AllowMultipleSelection
=
"false"
/>
Hi Marko,
To use the field build in visual studio and it will generate PageSelectorSample.dll, add reference to the project .dll in your sitefinity site and build it. To use the control:
1. Add Global.asax to the project and in it register the PageSelectorSample dialog that will open for selecting pages.
protected
void
Application_Start(
object
sender, EventArgs e)
Bootstrapper.Initialized +=
new
EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(Bootstrapper_Initialized);
public
void
Bootstrapper_Initialized(
object
sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
Telerik.Sitefinity.Web.UI.Dialogs.RegisterDialog<PageSelectorDialog>();
Stefani, thanks for your help, but I'm afraid that I'm not able to follow this code. Where does this demonstrate how to hook into the "external" page value?
Furthermore, is this a "sample" widget (demonstrating how to interact with the page selector), or are you suggesting that I reference this my custom widget, rather than using regular PageSelector? If latter, then why? What's wrong with the built-in PageSelector? There isn't an easy way to interact with the external page value (which is available in the UI)?
Hi,
If I understand correct you want to have external URL in a custom widget designer. One possible solution in your case is to use PageField in conjunction with a text box to separately get an external URL from user.
Greetings,
Stefani Tacheva
the Telerik team
That's the approach I'm exploring right now. That was my original assumption, actually, until I discovered the "AllowExternalPagesSelection" property, which reveals a nice external URL property in the UI.
It's a shame there isn't a way to grab that value as easily as grabbing the Page GUID that's been set through the designer UI.
Hello Marko,
I agree with you and I will forward this communication to our developers.
All the best,
Stefani Tacheva
the Telerik team
Marko,
I know you are probably looking for a simple approach, however, if you have some time on your hands do some digging into the LinkManagerDialog.
This is the dialog that the HtmlEditor in Sitefinity uses for links. If you go to "yoursiteurl.com/.../LinkManagerDialog" you will see the dialog. There should be a way to reference that as a dialog in your own widget.
Thanks,
Chris
Hello,
Thank you Chris for your help and for sharing your suggestions.
All the best,
Stefani Tacheva
the Telerik team
Hello,
I'm also facing such kind of problem. I've to include a external page in my project of Sitefinity so, there is an option Create a page when we click that there came an option with check box i.e. This page redirects to another page inside that as Marko told that there are 2 options From this site or From other site .I've to include a page of ASP.NET (.aspx) to this site I've entered the URL of that page but it is throwing 404 error of can't find page and not redirecting to that page. Please provide me the proper solution for this with format of URL to pass.
Hello,
In order to redirect to a aspx page, you need to the the following: