private string RenderSelectBox(UsedProperty property) { var sb = new StringBuilder(); sb.AppendFormat("<div class=\"filter-select\"> <select id=\"prop_{0}\" name=\"prop_{0}\"> ", property.PropertyId); sb.AppendFormat("<option value=\"0\">{0}</option> ", Resources.Resource.Client_Catalog_FilterProperty_Any); var selectedChanged = false; foreach (var value in property.ValuesList) { if (AvaliblePropertyIDs == null || (AvaliblePropertyIDs != null && AvaliblePropertyIDs.Contains(value.PropertyValueId))) { var selected = !selectedChanged && SelectedPropertyIDs != null && SelectedPropertyIDs.Contains(value.PropertyValueId); sb.AppendFormat("<option value=\"{0}\"{1}>{2}</option> ", value.PropertyValueId, selected ? " selected=\"1\"" : string.Empty, value.Value); if (selected) { selectedChanged = true; } } } sb.AppendLine("</select> </div>"); return(sb.ToString()); }
private string RenderCheckBox(UsedProperty property) { if (property.ValuesList.Count == 0) { return(string.Empty); } var sb = new StringBuilder(); sb.Append("<div class=\"chb-list propList\"> "); foreach (var value in property.ValuesList) { sb.AppendFormat("<div> <input name=\"prop_{0}\" type=\"checkbox\" id=\"prop_{1}\" value=\"{1}\"{2}{3} /> <label for=\"prop_{1}\">{4}</label></div> ", property.PropertyId, value.PropertyValueId, AvaliblePropertyIDs != null && !AvaliblePropertyIDs.Contains(value.PropertyValueId) ? " disabled=\"disabled\"" : string.Empty, SelectedPropertyIDs != null && SelectedPropertyIDs.Contains(value.PropertyValueId) ? " checked=\"checked\" " : string.Empty, value.Value ); } sb.Append("</div>"); return(sb.ToString()); }