PageManager.GetTemplates not working
I am using SF 4.0 Beta 2
I am trying to create a SF page programmatically. I am running into the same problem using the SF API directly and also using the Fluent façade API:
this code: myPageManager.GetTemplates() returns nothing.
- it is used in the SF API example like this
- myPageData.Template = myPageManager.GetTemplates().First();
- and it is used in the Fluent API example like this
- Guid templateGuid = pManager.GetTemplates().First().Id;
- the error and inner exception that I am getting are
- "No items found in the sequence."
- "Enumeration yielded no results"
Please advise.
Thank you.
Hello Phillip,
I am not able to replicate this issue. There are built-in templates loaded as embedded resources like
Thanks Ivan. Your "embedded resource" comment made me try something which worked.
Background: Here is how I was testing my code: It is in an ascx user control and that is in a aspx page, in Visual Studio 2010. To test the code, I hit F5 and my aspx page opens. I click the button to run my code and GetTemplates() fails to find an item.
Solution: I changed the Start Options in Visual Studio so that ~/sitefinity/default.aspx (the Dashboard) opens when I hit F5. (My theory was that this would load the templates.) THEN I go to my MakePage.aspx page and GetTemplates() finds a template.
Question: what C# code would load the templates (and maybe other embedded resources) programatically.
Hi Phillip,
There are two methods that you can use
Thanks Ivan. That all makes sense. I dont have the permissions I need because I am not logged in.
So what is the C# code that I can use to programatically log in?
Thanks.
Hello Phil,
You can check out this forum thread for more information on programmatic login. We are also going to provide the ability to login through a web service. But this will be available after the RC.
All the best,
Radoslav Georgiev
the Telerik team