Published on

How To List

Authors

How-To…

404 Error Page
Add more default sized for images
Auto-Resize Custom Designer Window
Avoid Version errors with Assembly Binding
Hook into dynamic content events
Change CDN URLS
Change the Title of a custom designer
Change Widget Icons
Change Url Regex Validation
Delete a Forms Column from the database
Fix: Dangerous Request.Form value Error
Forms Input Validatation
Get the content of a newsletter
Get Category of an Item
Get Filter Applied to a Widget
Get the URL of an Item
Get a Control Reference
Hide items from the toolbox
Get Last Modified Pages
jQuery in your Masterpage
List of Pages which a certain control type
Loading Tweets with Javascript
Modify Control Filtering
Prefix your form tables in the database
Programmatic Login
Rename a Forms Database Table
Remove the Edit Button on a widget
Run with multiple Worker Processes and avoid errors
Speed up Development Cache
Store your Config in the DB
Style Design Mode
Setting a good ToolsFile.xml on the RadEditor
Transform RSS XML to HTML
Use Content Selectors in your Custom Controls
Write Advanced Filtering Expressions
Get Sitefinity Version Number

404 Error Page

Boyan came up with a great tutorial on a 404 page, complete with video!

Answered By: Boyan Barnev
Reference Url: Link

Back to top

Add more default sized for images

Go to Administration -> Settings -> Advanced and from there

ContentView -> Controls -> AlbumsBackend -> Views -> AlbumsBackendInsert -> Sections -> DefaultImgSizeSection -> Fields -> NewSize -> ChoicesConfig - and there are the choices you can edit, update and add new sizes.

Answered By: Pavel Benov
Reference Url: Link

Back to top

Auto-Resize Custom Designer Window

Back to top

Avoid Version errors with Assembly Binding

View blog post

Answered By: Me
Reference Url: Link

Back to top

Hook into dynamic content events

https://bit.ly/Rxbk1U

Back to top

Change CDN URLS

This will let you specify the URLs to obtain jQuery, MsAjax, etc

https://www.sitefinity.com/ClientsFiles/261752_jquerycdn.png

Back to top

Change the Title of a custom designer

In the top of your SimpleView class where you define the designer class, just append this

This will replace the default “Edit” at the top of the popup designer!

Back to top

Change Widget Icons

  1. Add class name in the backend toolbox settings
  2. Edit your stylesheet and add in that new class
  3. Define the image using a css background image (preferably a single sprite instead of a single image for every custom widget)

Answered By: Steve
Reference Url: Link

Back to top

Change Url Regex Validation

When you type a title it auto-generates the content item url based on a regex value.  Here’s how you can change it for images (docs\etc are similar)

Administration->Settings->Advanced->Libraries->Controls->ImagesBackend->Views->ImagesBackendEdit->Sections->AdvancedSection->Fields->UrlName->Validation and scroll down to the Regular Expression field

Answered By: Pavel Benov

Back to top

Delete a Forms Column from the database

As you properly pointed out, each time a from is created, a corresponding table for this form is also created in the database. However, you cannot simply delete the column. Each control is also stored in the sf_meta_fields table as a dynamic property, so after you restart your application, Sitefinity will first check all dynamic properties, compare them to the columns in the form tables, and if a column is missing, will recreate it. This is why if you want to delete the column of the control from the database you should perform the following steps:

  1. Delete the widget from your form;
  2. Go to sf_meta_types, find the id of your form and with this id, find the corresponding dynamic property in the sf_meta_fields table.
  3. Then delete the property and delete the column in the form table.

Answered By: Jen Peleva

Back to top

Fix: Dangerous Request.Form value Error

This is an asp.net issue, and should be fixed in 4.5, but basically if you try and submit content in sitefinity and the content looks “dangerous” (like submitting html), then you get this error:

A potentially dangerous Request.Form value was detected from the client

Simple fix though (open your web.config)

Answered By: Stanislav Velikov

Back to top

Forms Input Validatation

Great article on how to set validation on the form input elements

Answered By: Grisha Karanikolov
Reference Url: Link

Back to top

Get the content of a newsletter

Now since the campaigns can be created either by writing html, created from template or building them as a page it is not just getting the text. You have to call a class called RawMessageSource which parses the message content and gives you the output html:

Answered By: Radoslav Georgiev
Reference Url: Link

Back to top

Get Category of an Item

Back to top

Get Filter Applied to a Widget

You need to get an instance of the control on your page. Then you can
call MasterViewDefinition.FilterExpression. This will get the filter
that is set as a property of the control. Another option is overriding
InitializeControls method MasterView that your widget uses and there
check whether the dynamic filter expression returns results.
The third option is getting the date query from the url evaluator

DataProviderBase.SetExpressions 

To see if there will be items returned by your control.

Answered By: Ivan Dimitrov
Reference Url: Link

Back to top

Get the URL of an Item

Answered By: Ivan Dimitrov
Reference Url: Link

Back to top

Get a Control Reference

You should do the following - iterate through the Controls collection of a PageData and then use page managers .LoadControl() for each control and verify the returned result

 

Answered By: Lubomir Velkov
Reference Url: Link

Back to top

Hide items from the toolbox

hide an image

Answered By: Boyan Barnev
Reference Url: Link

Back to top

Get Last Modified Pages

 

Answered By: Boyan Barnev
Reference Url: Link

Back to top

jQuery in your Masterpage

 

This is the preferred way to do it as it’ll load whatever the current embedded jQuery version is inside of sitefinity.

Answered By: Ivan Dimitrov
Reference Url: Link

Back to top

List of Pages which a certain control type

 

Answered By: Svetoslav Petsov
Reference Url: Link

Back to top

Loading Tweets with Javascript

Create the markup the json will be loaded into. In the page editor drop in a new Javascriptembed widget and place the following code into it’s editor.

 

Make sure to replace “stevemcniven” with whatever your twitter name is, and also you can change the “count” to something other than “1” :)

**IMPORTANT STEP**
Make sure the widget loads the script at the end of the page before the end body tag…it’s one of the radio buttons.
…and this should be obvious, but please make sure you’re loading jQuery somewhere so this runs :)

Answered By: Barney
Reference Url: Link

Back to top

Modify Control Filtering

This post by Boyan shows you how to change filters on your controls so they don’t conflict.

Answered By: Boyan Barnev via Ivan Dimitrov
Reference Url: Link

Back to top

Prefix your form tables in the database

By default sitefinity just willy-nilly creates new tables for forms named as some version of the form name itself.  However most people who look at sql would prefer to have them all grouped together in sqlms.

So here’s how you can set a prefix:

  1. Administration->Settings->Advanced
  2. ContentView->Controls->Forms Backend->Views->FormsBackendInsert->Sections->MainSection->Fields->Name
  3. Edit the prefix text property

Answered By: Pavel Iliev
Reference Url: Link

Back to top

Programmatic Login

 

Answered By: Radoslav Georgiev
Reference Url: Link

Back to top

Rename a Forms Database Table

I’ve been a big supported of the idea that forms need to have a prefix, otherwise your schema will go all to hell since the default naming is “sf_form_title”…bleh.  So this will retroactivly allow you to fix those.

 

Answered By: Ivan Pelovski

Back to top

Remove the Edit Button on a widget

This is something that should be in there with “Granular Permissions”…however in the meantime, MVP Tim has a quick jQuery workaround!

 

Thanks Tim!

Reference Url: Link

Back to top

Run with multiple Worker Processes and avoid errors

By default if Sitefinity is running in a single server scenario we use data cache for OpenAccess to minimize the queries to the database as OpenAccess caches the results.

However if your website is setup to run under multiple application pools the data cache must be disabled. Otherwise each application pool will use the OpenAccess data cache and there will be discrepancies between the cache on both pools, and you will receive exceptions such as this one.

In this case you must disable the cache by going to Administration -> Settings -> Advanced -> Data and set EnableDataCaching to false.

Answered By: Radoslav Georgiev

Back to top

Speed up Development Cache

The basic concept is that you’re setting IIS to compile the pages to a RAM Disk, very smart!

Answered By: Jochem Bokkers
Reference Url: Link

Back to top

Store your Config in the DB

Configuration files are a “mirror” of the database. Every time you open or modify your project it gets information from its configuration files. Right before that configuration files verify that same configurations are available in the database, and only when this condition is fulfilled, information is send to your project. In other words, when your config file is opened, it connects to the database, makes sure that configurations at both places are the identical and then sends information for a change (dummy change) to your project . That’s why you get a “file has changed” massage when no actual change has been done. With the release of Sitefinity 4.0  you are able to move your configuration files to the database, as shown in this blog

post. If this is done, there won’t be any verification between your project and the database and you won’t get warning messages.

Link

Answered By: Radoslav\Jen
Reference Url: Link

Back to top

Style Design Mode

Its as simple as knowing the css classes to target!

 

Full Article

Answered By: Sitefinity Steve
Reference Url: Link

Back to top

Setting a good ToolsFile.xml on the RadEditor

Go to Settings->Advanced->Appearance

So this is the RadEditor configuration…

Here’s a good basic Editor config that wont let your editors screw with Fonts (for example)

 

Save this to ~/App_Data/ToolsFile.xml

** The FormatCodeBlock is for me ** :)  General non-programming sites will not need it

Ok so now in the settings area, change the StandardEditorConfiguration, and MinimalEditorConfiguration to be ~/App_Data/ToolsFile.xml

Save, and done!

Back to top

Transform RSS XML to HTML

  1. Go to Administration>Settings - click on Advanced link
  2. Go to Publishing and select Transform RSS XML to HTML option (see attached file)
  3. Save Changes

Note: you may need to reset your Website Project

Answered By: Sonya
Reference Url: Link

Back to top

Use Content Selectors in your Custom Controls

This is a blog post by Josh Morales (SelArom), shows how you can use the built-in sitefinity page, image, etc selectors in your custom controls.

Good read!

Answered By: Josh Morales
Reference Url: Link

Back to top

Write Advanced Filtering Expressions

 

Answered By: Atanas Valchev

Back to top

Get Sitefinity Version Number

 

Back to top