I am doing a web project, And I met a problem that, I want to give a counter for each date. For example, if two records are created on June 22, then the counter for June 22 should be 2. And if one record is created on June 23, then the counter for June 23 should be 1. I am thinking about using a dictionary to achieve this goal. I define a ASP.NET hidden field, and then assign a dictionary to its value in code behind. The date is the key, and the counter value is the value. The code I have so far is:
<asp:HiddenField ID="hdnRefDictionary" runat="server" />
hdnRefDictionary.Value = new Dictionary<string,int>(); // Not working since cannot convert Dictionary to string.
Thanks in advance, and Have a good day!
Cheers, Jiang Hao
consider using Json.Net as
on post/desialize simple deserialize
please note if you put complex objects in dictionary you may have to override their ToString() method and/or handle serialization/Deserialization yourself using JsonConvertor