Google Chrome to take number 2 Spot

According to ComputerWorld Google’s Chrome is on the brink of replacing Firefox as the second-most-popular browser, says the Web statistics firm StatCounter, which shows that Chrome will pass Firefox to take the No. 2 spot behind Microsoft’s IE no later than December. As of Wednesday, Chrome’s global average user share for September was 23.6%, while Firefox’s stood at 26.8%. IE, meanwhile, was at 41.7%. The climb of Chrome during 2011 has been astonishing: It has gained eight percentage point since January 2011, representing a 50% increase. During that same period, Firefox has dropped almost four percentage points, a decline of about 13%, while IE has also fallen four points, a 9% dip. That means Chrome is essentially reaping all the defections from Firefox and IE.

Read the article here: http://www.computerworld.com/s/article/9220396/Chrome_poised_to_take_No._2_browser_spot_from_Firefox

Advertisements

ASP.NET MVC – Binding to Dictionary

Today I came across a situation where I had a display a list of combo boxes inside a part of a complicated tab based form. The model of the view was a different object then this particular section I was trying to render. I had a different controller action to do the updates.

After googling I came across this article from Scott ASP.NET Wire Format for Model Binding to Arrays, Lists, Collections, Dictionaries which turned out to be very helpful.

While implementing this all I need the binder to return something like a dictionary of int key with int value.

[HttpPost]
public ActionResult EditProjectAccess(int? id, Dictionary<intint> ProjectAccess)
{
}

So in my View I used the following snippet:

Var counter = 0;
foreach (var item in ProductGroups)
{
<fieldset>
<legend>@item.GroupName</legend>
@foreach
(var pj
in
item.Products)
{            

    <dl>
    <dt>@pj.Name:</dt>
    <dd
class=”text”>
    
@if
(Model.ResourceId

==

pj.ProjectManagerId)
    {
        <text><strong>Project
Manager</strong></text>
    }
    else
    {
        @Html.Hidden(“ProjectAccess[” + counter + “].key”, pj.ProductId)
        @(Html.DropDownList(“ProjectAccess[” + counter + “].value”new SelectList(new List<Object>{
          new { value = “0” , text = “No Access”  },
          new { value = “1” , text = “Participant” },
          }, “value”“text”, pj.HasAccess(Model.ResourceId)?0:1)))
        counter++;
     }
    </dd>
    </dl>
    
}

</fieldset>
}

 

The key here was using the Hidden field for storing the key name, and the combo box for the value field. One thing though the counter values should be incremental, i.e. no gaps in sequence. Else on the model you will only get up to the sequenced item.

So now I can easily get access to my dictionary list and figure what each of those combo was values was selected to. The key can be string as well and the value can be complex object. Just follow Scott’s blog article.