Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Hi,
page.LinkURL already contains parameters (id, epslanguage and so on). So you cant pass ?-sign in the parametername. This should be correct:
string url = UriSupport.AddQueryString(page.LinkURL, "docid", DocumentId);
Which would result in /Templates/Page.aspx?id=13515&epslanguage=sv&docid=12345
Why do you set the page.LinkURL?
You could also do this directly in you template (aspx-file).
<%= CurrentPage.LinkURL + "&docid=" + DocumentId %>
Hi
I doesn't work. I use a PageList and for every page I create in that list I show the same page but with different content that’s why I need to change the LinkURL.
Here is the code
//delete pages before create new
DataFactory.Instance.DeleteChildren(rightMenu.PageListRoot, false, AccessLevel.Delete);
foreach (DocumentList docList in medicalSourceDocumentsList)
{
pagelink = DataFactory.Instance.GetDefaultPageData(rightMenu.PageListRoot, 44);
clonelink = pagelink.CreateWritableClone();
clonelink.PageName = docList.DocumentTitle;
clonelink.Property["Title"].Value = pageListControl.CurrentPage.Property["Title"].Value;
clonelink.Property["RootPage"].Value = pageListControl.CurrentPage.Property["RootPage"].Value;
//Build querystring
clonelink.LinkURL = UriSupport.AddQueryString(clonelinkSeeAlso.LinkURL, "docid=", docList.DocumentId);
DataFactory.Instance.Save(clonelink, SaveAction.Publish, AccessLevel.Read);
linkDataCollection.Add(clonelink);
}
pageListControl.DataSource = linkDataCollection;
pageListControl.DataBind();
Ok. Deleting and saving pages is kinda time consuming, so it's not recommended to do that on every rendering.
I'm not sure you can save a page with another LinkURL. And in your code I don't think the LinkURL is generated yet, because it needs a roundtrip to the database to get an id to the page.
I would recommend using my other solution, adding the docid on rendering in the pagelist instead. You can store the docid in a property on the page.
<%# Container.CurrentPage.LinkURL + "&docid=" + Container.CurrentPage["DocumentID"] %>
You can also set an external link on the page.
cloneLink.LinkType = PageShortcutType.External;
cloneLink["PageExternalURL"] = UriSupport.AddQueryString(clonelinkSeeAlso.LinkURL, "docid", docList.DocumentId);
PageExternalURL is a built-in property that you find on the 'Category' tab in edit mode. And you should not have a ? or = in your queryparameter name.
Yes i solved it by using querystrings and change the view depending on the id instead of creating pages.
Hi
How can I build a correct link that includes querystring parameters? and how can I get the querystring parameters on the receiving page.
I have a
PageData page;
And try to change LinkUrl for that page like this:
page.LinkURL = UriSupport.AddQueryString(page.LinkURL, "?docid=", DocumentId)
and then I use Request.QueryString["docid"]
but I only get the querystring {&id=13515&epslanguage=sv}