/// <summary>
/// Shows the edit.
/// </summary>
/// <param name="attributeId">The attribute id.</param>
protected void ShowEdit( int attributeId )
{
var attributeModel = new AttributeService().Get( attributeId );
if ( attributeModel != null )
{
var attribute = AttributeCache.Read( attributeModel );
lActionTitle.Text = "Edit Attribute";
hfId.Value = attribute.Id.ToString();
tbKey.Text = attribute.Key;
tbName.Text = attribute.Name;
tbCategory.Text = attribute.Category;
tbDescription.Text = attribute.Description;
ddlFieldType.SelectedValue = attribute.FieldType.Id.ToString();
BuildConfigControls( attribute.QualifierValues );
tbDefaultValue.Text = attribute.DefaultValue;
cbMultiValue.Checked = attribute.IsMultiValue;
cbRequired.Checked = attribute.IsRequired;
}
else
{
lActionTitle.Text = "Add Attribute";
hfId.Value = string.Empty;
tbKey.Text = string.Empty;
tbName.Text = string.Empty;
tbCategory.Text = ddlCategoryFilter.SelectedValue != "[All]" ? ddlCategoryFilter.SelectedValue : string.Empty;
tbDescription.Text = string.Empty;
FieldTypeService fieldTypeService = new FieldTypeService();
var fieldTypeModel = fieldTypeService.GetByName( "Text" ).FirstOrDefault();
if ( fieldTypeModel != null )
{
ddlFieldType.SelectedValue = fieldTypeModel.Id.ToString();
}
BuildConfigControls();
tbDefaultValue.Text = string.Empty;
cbMultiValue.Checked = false;
cbRequired.Checked = false;
}
pnlList.Visible = false;
pnlDetails.Visible = true;
}