Sitecore Droplist in Editing Mode - razor

I have set Droplist field in template and set the source. I can see all list items in source path and want to generate the list in Page Editor by element.
I'd like to set different functionality between editor mode and preview mode by using "Sitecore.Context.PageMode.IsPageEditorEditing".
When the page is Editing mode, authors can see the element to choose one of the lists. If it is preview mode, authors will see the value what they chose in the editing mode element.
How can I implement??
I'm using Razor.

Normally in Sitecore you need an EditFrame to handle editing of Droplists in the Page editor. This however is not supported in MVC by default, but there's a great post here on how to get it working:
https://visionsincode.wordpress.com/2015/01/08/how-to-use-editframe-in-sitecore-mvc/
Alternatively you can set a 'custom experience button' to enable editors to change the droplist value when in the Page editor:
To set this up follow these steps:
Change to Core database
Create a new item under /sitecore/content/Applications/WebEdit/Custom Experience Buttons using the template /sitecore/templates/System/WebEdit/Field Editor Button
In this new item, set the value of the 'Fields' field to the name of your templates DropLink field (also set appropriate icon/header/tooltip field values)
Go back to the master database
Select your sublayout/rendering and in the field 'Page Editor Buttons' select your newly created button item.
Once this is setup when you edit the component and click the button editors will be able to change the value for the droplist.

Related

passing value from a page into inline dialog oracle apex

I would like to create an inline dialog.
In this inline dialog I want to start a search with the entries I made on the same site. I want to pass these entries to the inline dialog to start the search.
My question is, is it possible to pass parameters when creating an inline dialog.
Usually I always used a modal dialog for this.

Hyperlink box (txtbox) on Access Form won't allow drop

I have a MS Access form that is bound to a query in the database. I added a textbox and added a row source to a Hyperlink datafield in the query. When I open the form, it won't allow me to drop a file into the textbox.
Here's the deal. When I follow this EXACT same process on a new form, it works perfectly. That is, I open a blank form and I bind the form to some new query, let's say qryNewIdeas. Then on the blank form i add a textbox, let's say Text0. Then, when I select Text0, I go to the data tab - row source and choose the dropdown arrow to select the hyperlink field, lets say NewIdeasAddress. I click SAVE and open the form. It works PERFECTLY.
BUT, when I repeat this on an existing form (the one where I need the thing to actually work), it does nothing. It adds and changes the textbox to a hyperlink box (I note this because of the blue underlined word that appears in the box). But it won't allow me to drop files to this location.
I tried commenting out ALL of my VBA code to try to make sure that something wasn't hindering it (say in an OnLoad event) AND I've checked all of the form and control box properties and they seem to be the same in both the existing form and the test form.
I can't determine why it works on one form and not the other; Solution needed.
If you have access to "the data tab - row source ..", you are in design view.
When you later open the form, you are in form view, a completely different animal which specifically prohibits design changes.
It sounds like you will have to rethink your concept.

Swap Component Datasources Without Placeholders (Sitecore)

If I bind a component statically, I can't swap out the datasource from the page editor:
#Html.Sitecore().Rendering("/*Path to rendering*/",
new { DataSource = "/*Path to datasource*/" })
Using a placeholder lets me swap datasources, but requires more overhead and can let the content editor insert multiple components where there should only be one:
#Html.Sitecore().Placeholder("placeholderName")
Is there a middle-ground here? I want the content editor to be able to change datasources without having to use a placeholder.
Make your datasource path/Guid a field on your current page item?
Use a placeholder with a very restrictive placeholder setting?
The latter won't stop multiple components but at least it could limit options.
You can personalize your content base on a custom condition ( rule ) where you add a specific condition to sitecore that the content editor can then select the required widget and click personalize then add this custom condition and datasource the widget based if the condition true or false ; This can be used more than one time on the same widget.
for more details check the following:
https://briancaos.wordpress.com/2013/09/10/custom-rules-and-conditions-for-sitecore-personalization/

custom/editor tabs order in sitecore

I'm trying to find a way to change order of sitecore custom / editor tabs. by default sitecore displays custom tabs, content tab and dynamic tabs, and according to
https://www.markstiles.net/Blog/2011/02/27/editor-tabs-in-sitecore.aspx
the only way to change order of tabs is to dig into sitecore. sitecore forum isn't helpful either. any ideas if this is configurable in sitecore? above mentioned post is pretty old and sth might have changed since then, but I haven't found any info about it.
As of Sitecore 8.0 update 3, the sitecore code for retrieving the tabs is still the same with the addition of the buckets tab:
Retrieved from Sitecore.Client.dll in the Sitecore.Shell.Applications.ContentManager.Editor class
private static List<Editor.EditorTab> GetEditorTabs(Item item, Editor.Sections sections)
{
Assert.ArgumentNotNull(item, "item");
Assert.ArgumentNotNull(sections, "sections");
List<Editor.EditorTab> editorTabs = new List<Editor.EditorTab>();
Editor.GetCustomEditorTab(item, editorTabs);
Editor.GetCustomEditorTabs(item, editorTabs);
Editor.GetContentTab(item, sections, editorTabs);
if (InternalSettings.ItemBucketsEnabled)
{
Editor.GetNewSearchTab(item, sections, editorTabs);
}
Editor.GetDynamicTabs(item, editorTabs);
return editorTabs;
}
So unfortunately, it looks like this is still the order by which they get rendered. As the article mentions, this could potentially be overridden, but likely to be quite involved.
I've achieved this slightly different. Not 100% satisfied with the solution, but it works until there is a better option.
In my custom tab, that displays as the first tab and therefore the active tab when I select an item. I have added the following JavaScript code to change the active tab back to the standard Sitecore Tab.
parent.scContent.onEditorTabClick(this, null, "Content");
The code goes up to the parent window as the Tab is an iFrame and set the active tab to the "Content" tab.
My custom tab is a SPEAK tab running on Sitecore 8. Here is the SPEAK javascript PageCode for reference.
https://github.com/sobek1985/SitecoreContentEditorTabs/blob/Complete/SitecoreContentEditorTabs/SitecoreContentEditorTabs.js
And a blog post i wrote on the subject too: http://mikerobbins.co.uk/2015/07/14/sitecore-content-editor-tabs-in-speak/

Hyperlink control in Access App

I've created a hyperlink control on a form page in an Access 2013 App hosted in SharePoint 2013, and want the text to display the same text ("Print Timesheet") while the actual link itself varies based on the value of a field in the record. This is so that I can link to a separate application using a query string with the individual record ID, which gets the data directly from the azure database and formats it in order to be printed out.
I've tried a macro expression to create the link address that runs "on current" and sets the value of the hyperlink, and also tried a computed column in the table to create the link which I pass to the hyperlink control value. I've set the "Default Display Text" on the hyperlink control to "Print Timesheet" in both cases.
The problem I have is that whichever way I try it, changing the value on the fly like this overrides the default display text of the hyperlink so that it displays the address itself rather than the text I want to display.
Is there any way round this?
Thanks,
Duncan
I am not sure if you got your answers. I was randomly looking on internet and found your query.
I thought the thread Troubles with Hyperlink control in Access Web App forms may have your answer.
LILizEidsness replied on August 21, 2014See post history
.....
If you have to build a url field dynamically, the basic syntax is
displaytext#url#
so, in my dynamic field....
=Concat("Click here#/relative/path/on/my/sharepointsite/allitems.aspx&ID=",[ID],"#")
....
You could use a label on the form to represent the link. Have the Label.Caption property set to "Print Timesheet" and use the On Current event to set the Label.HyperlinkAddress property to whatever the address from the recordsource is.