As per our e-mail conversation, it seems that differences in our terminology has caused some confusion. Searchable means enabling the Smart Search module to be able to look at the custom columns when looking for data. Sorting through the UniGrid under CMS Desk > On-line Marketing > Contacts would be considered Filtering. In order to add the custom columns to both the UniGrid, and as one of the filtering options, two files will have to be modified:
In the list file, you will first add the custom column to the UniGrid list of Columns on line 9:
<cms:UniGrid runat="server" ID="gridElem" ObjectType="om.contactlist" OrderBy="ContactLastName"
Columns="ContactID,ContactLastName,ContactFirstName,ContactEmail,ContactStatusID,ContactCountryID,ContactSiteID,ContactMergedWithContactID,ContactGlobalContactID, ContactCreated, TestColumn"
IsLiveSite="false" HideFilterButton="true" FilterByQueryString="true" RememberDefaultState="true" RememberStateByParam="issitemanager">
Then, you will add that column to the Grid, similar to the way other columns have been added in that same file:
<ug:Column Source="TestColumn" Caption="Test" Wrap="false">
Once added, the column and its values should start appearing in the list of contacts.
Now to update the filter(.aspx), you would add an additional label and TextSimpleFilter:
<cms:LocalizedLabel ID="lblTestColumn" runat="server" ResourceString="test"
DisplayColon="true" EnableViewState="false" />
<cms:TextSimpleFilter ID="fltTestColumn" runat="server" Column="TestColumn" />
You can set the visibility for both to Enabled, or you can set some logic in the codebehind (Filter.ascx.cs Page_Load) if needed:
lblTestColumn.Visible = true;
fltTestColumn.Visible = true;
You would also update the GenerateWhereCondition()
method on around line 385 to include the additional where condition:
whereCond = SqlHelperClass.AddWhereCondition(whereCond, fltFirstName.GetCondition());
whereCond = SqlHelperClass.AddWhereCondition(whereCond, fltLastName.GetCondition());
whereCond = SqlHelperClass.AddWhereCondition(whereCond, fltEmail.GetCondition());
whereCond = SqlHelperClass.AddWhereCondition(whereCond, fltTestColumn.GetCondition());
Once all these changes have been made, you should have the ability to see and filter with your custom columns. Also, instead of using "test" as the ResourceString, you will likely want to create a custom resource string
However, if the idea here is to get a list of contacts for reporting\exporting purposes, using the Reporting Module
would be more appropriate.
You could create a custom report which allows you to define a custom set of parameters (your custom columns) then export the data in any of the available formats (XML, CSV, etc):New ReportReport ParametersExporting Reports
Please let me know if you have additional questions.