1

I am looking at a trial of the Ajax Browser Control by ItHit. So far it seems to be pretty responsive when it comes to pulling files across http protocol.

What I want to do at this point is have the details view pull custom properties from my excel workbooks. What is the most efficient way to connect my C# code that gets the custom properties to the Ajax control to display the correct values?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
Idea Man
  • 85
  • 1
  • 6

1 Answers1

0

The easiest way to create a custom column is to return custom property from a WebDAV server. In the example below the server returns price in PricesNs:RetailPrice property.

On a client side you will define a custom column and specify custom property name and namespace:

{
    Id: 'MyColumn1',
    CustomPropertyName: 'RetailPrice',
    CustomPropertyNamespace: 'PricesNs',
    Text: 'Retail Price',
    Width: '150px'
}

Another approach is to return an HTML from a Formatter function specified for column. You have a full control over what is being displayed in this case.

You can find more details and an example in this article: http://www.webdavsystem.com/ajaxfilebrowser/programming/grids_customization/

In case your WebDAV server is running on IT Hit WebDAV Server Engine, to return the requested property, you must implement IHierarchyItem.GetProperties method (or its asynchronous counterpart):

public IEnumerable<PropertyValue> GetProperties(IList<PropertyName> names, bool allprop)
{
    if (allprop)
    {
        return getPropertyValues();
    }

    List<PropertyValue> propVals = new List<PropertyValue>();
    foreach(PropertyName propName in names)
    {
        if( (propName.Namespace == "PricesNs") && (propName.Name == "RetailPrice") )
        {
            // Depending on the item you will return a different price,
            // but here for the sake of simplicity we return one price regerdless of the item
            propVals.Add(new PropertyValue(propName, "100"));
        }
        else
        {
            ...
        }
    }
    return propVals;
}
IT Hit WebDAV
  • 5,652
  • 12
  • 61
  • 98
  • The custom properties are only on files, how do I check that it's not a folder before I add the property? – Idea Man Jul 30 '15 at 14:51
  • Is it true that the GerProperties runs after the yield return in the GetChildren method? I need to filter the files returned based on a particular property. The properties are not available in the GetChildren method. – Idea Man Jul 30 '15 at 16:02