API Questions on Kentico API.
Version 6.x > API > Getting a web part settings checkbox value View modes: 
User avatar
Member
Member
Rawe - 5/4/2012 10:04:19 AM
   
Getting a web part settings checkbox value
I have created a web part which has a checkbox in it's settings.

To obtain a value entered into a textbox in the settings, I can use the following code in the ascx.cs file for the web part:

string Title = (string).this.GetValue("Title");

How would I go about obtaining a checkbox value?

User avatar
Member
Member
kentico_michal - 5/6/2012 4:10:30 AM
   
RE:Getting a web part settings checkbox value
Hi,

Could you please try to use the following code:

bool value = ValidationHelper.GetBoolean(this.GetValue("<property>"), <default value>);

Best regards,
Michal Legen

User avatar
Member
Member
Rawe - 5/8/2012 11:08:41 AM
   
RE:Getting a web part settings checkbox value
That's worked great, thank you!