November Happy Hour will be moved to Thursday December 5th.

how to make checkbox checked by default in episerver

Vote:
 

Hi

Can any one please tell me how to make checkbox checked(true)  by default  in editor view 

Thanks in advance

Sourav

#170764
Oct 28, 2016 17:01
Vote:
 

Two ways

First the old, ugly and not to use way (that must be used before epi version 7), set the default value inside admin

Second the new shiny good way: Set default value to true in your code definition for the pagetype:

//Sets the default property values
public override void SetDefaultValues(ContentType contentType)
{ 
   base.SetDefaultValues(contentType);     //Set up your defaults here 
 }

Read more here:

http://world.episerver.com/blogs/Alexander-Haneng/Dates/2012/9/How-to-define-default-values-for-pages-and-blocks-in-EPiServer-CMS-7/

#170765
Oct 28, 2016 17:22
Vote:
 

You could also revert the logic, I usually do that.

Ex, instead of having ShowSomething that is checked, you could have HideSomething that is unchecked and check it only when necessary.

BR,

Marija

#170810
Oct 31, 2016 11:10
Vote:
 

// This approach works for already created pages as well. If you are using SetDefaultValues, that will work only when you create a new page.

#170811
Oct 31, 2016 11:11
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.