Documentation for Tag Cloud/ code behind.

Jun 23, 2011 at 1:56 PM

Hiya,

 

I have followed the url's for docuementation for the tag Cloud project, but have found nothing bar the readme.txt.

Is any available yet?

i have this working great in ASPX- however i need to put it in code behind (I think!) to do run time pushes to it.

The problem is that the doc shows

 

 HtmlGenericControl div = new HtmlGenericControl("div");
            div.InnerHtml = new TagCloud.TagCloud(...)

With the ...'s being the set up.

When I use the setup that works in the ASPX file, or in fact any of the examples, I get "Cannot implicitly convert type 'TagCloud.TagCloud' to 'string'.

An example of this is
String   daftString="Meat";
HtmlGenericControl div = new HtmlGenericControl("div");
            div.InnerHtml = new TagCloud.TagCloud(daftString.Split(' '), TagCloudGenerationRules.Default);

or

 div.InnerHtml = new TagCloud.TagCloud(daftString.Split(' '), TagCloudGenerationRules.Default);

         (new Dictionary<string, int> {
         {"Meat", 99},
         {"Poultry", 45},
         {"Vegetables", 36}                   
        },
         TagCloudGenerationRules.Default);
         Controls.Add(div);

.etc.

I note the HTMLHelperExtensions has a series of tagcloud.tagcloud.tostrings etc (!)- but am having trouble understanding the call for these.

Anyone any more info/ docs/ sample code/ handy hints?

Kindest, J.

Jun 23, 2011 at 3:22 PM

Sorry to answer own post, but it was a simple .toString- looks a bit like this:-

 

           HtmlGenericControl div = new HtmlGenericControl("div");
            div.InnerHtml = new TagCloud.TagCloud(new Dictionary<string, int> {
                        {"Meat", 99},
                        {"Poultry", 45},
                        {"Vegetables", 36},
                        {"Fruit", 24},
                        {"Rice/Pasta/Grains", 13},
                        {"Bakery", 13},
                        {"Take Away", 20},
                        {"Ready Meal", 25}
                        },
                        new TagCloudGenerationRules
                        {    
                            HtmlAttributes = new Dictionary<string, object>()
                            {
                                {
                                    "onclick", "javascript:__doPostBack({0},'');"
                                }
                            } ,
                        Order = TagCloudOrder.Random, 
                        TagUrlFormatString = "?clicked={0}"}).ToString();
                                                                               ^^^^^^^
       
            plcMain.Controls.Add(div);       

 

- well, I say simple! ;-)

Just out of interest, has anyone fallen over a way to NOT order the tag cloud- I.e. it appears in the order input, but with the visual weighting still applied? intellisence gives various orders, but not a 'dont' or 'null'.

 

Cheers, J.