C# – Obout Grid filtering a column with text populated by a template

.netc++gridobout

I am attempting to filter a column in an Obout Grid that has been bound to a template.

Background

The DataField of the column is simply a foreign key ID to a History table that contains what are essentially states of a certain object (such as Name, Asset Tag, Serial Number, Additional Info., etc.) If a user were to change a certain state of the object (e.g. Additional Info), a new record would be added to the History table, and this new record is what is referenced by the aforementioned foreign key.

During databinding on the column, I am comparing the most recent history state with the one immediately prior, and returning an English description of what has changed (e.g. "The additional info field of this device has been modified") so that it can be displayed as text in each row.

The Problem

The grid itself seems to only filter the data on the client-side that was part of the original databind (in this case, simply the foreign key ID to the history record). I am able to filter by this number, though it does not actually show up in the column view because it has been replaced by the English description.

Grid Markup

<cc1:Grid ID="grdHistory" runat="server" AutoGenerateColumns="False" DataSourceID="dsHistory" AllowFiltering="true">
    <Columns>
        <!-- other columns snipped -->
        <cc1:Column DataField="DeviceHistoryID" HeaderText="Event description"  Width="450" Wrap="true"
            Index="3">
            <TemplateSettings  TemplateId="tplEventDescription" />
        </cc1:Column>
    </Columns>
    <Templates>
        <cc1:GridTemplate ID="tplEventDescription" runat="server">
            <Template>
                 <%# FormatEventDescription(Container.DataItem) %>
            </Template>
        </cc1:GridTemplate>
    </Templates>
</cc1:Grid>

FormatEventDescription(Hashtable Records) is the function that returns the English version of the changes to the object's state that I wish to filter on.

Question

Is there a way to filter by the English description in the column? At this point, any insight (design flaws, etc.) is welcome. I have tried both sifting through all of their documentation and even attempted to contact their support regarding this issue but have yet to receive a response.

Best Solution

I don't know much about the Obout's 3rd Party control, but appears to be subclassed from the .net GridView control. So you might ask the question again, but instead use gridview where the word Obout is, because apparently not many people use that particular control.

After briefly scanning the events of the grid, I think you might try using the RowDataBound event to do the necessary transforms.

Also you might be able to use the Selected event of the datasource to transform the data.

If you are able to transform the data to it's final readable state earlier, you may be able to filter it earlier in the chain of events that occur.

Related Question