Add a custom field for image in News widget

May 27, 2014

Add a custom field of type image to a news widget.
The following steps are given below

1. Add new custom field for News
2. Set its type to short text
3. Set “Interface widget for entering data” to Custom
4. In the custom textbox enter: Telerik.Sitefinity.Web.UI.Fields.ImageField
5. The image selector appears in the news publication view as expected and an image can be selected from local machine or image library

For more information check this, Add custom image field

Get choice field from dynamic module

May 27, 2014

Here is a simple way to get the list of possible values of a choice field of a dynamic module from code behind

Code snippet is given below.

var manager = ModuleBuilderManager.GetManager();
//Bind Choice field
var fieldList = manager.Provider.GetDynamicModuleFields().Where(f => f.Name == "YOUR_FIELD_NAME" && f.FieldNamespace == "YOUR_DYNAMICMODULE_NAMESPACE").Single();
var options =fieldList.Choices.Trim().Split(',');
TextReader txtReader = new StringReader(options[0]);
DataSet ds = new DataSet();
XmlReader reader = new XmlTextReader(txtReader);
//You will get list of choice field in xml
//And will convert it into DataTable
if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
    drpSelect.DataSource = ds.Tables[0];
    drpSelect.DataTextField = "text";
    drpSelect.DataValueField = "value";