ViewState error with dynamically built menu
<p>I have a Menu control that I dynamically populate with categories.  When a user clicks a category, the postback should populate a grid with products in that category.  However, I seem to have tried every way possible, i.e. whatever page life cycle time, only to always get this error:</p>

<p><em>Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.</em></p>

<p>Here is all my code:</p>

<pre><code>protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        BuildCategoryMenu();
    }
}

protected void categoryMenu_ItemClick(object source, DevExpress.Web.ASPxMenu.MenuItemEventArgs e)
{
    var catId = new Guid(e.Item.Name);
    ListProductsByCatId(catId);
}

private void BuildCategoryMenu()
{
    var cats = _categoryService.ListActive();
    categoryMenu.Items.Clear();
    foreach (var cat in cats)
    {
        categoryMenu.Items.Add(new MenuItem { Text = cat.Name, Value = cat.id.ToString() });
    }
}

private void ListProductsByCatId(Guid catId)
{
    productGrid.DataSource = _productService.ListByCatId(new Guid("a5c2f0ef-a3cc-4af1-abac-37f1be6a5c74"));
    productGrid.DataBind();
}
</code></pre>

<p>Here is my Menu:</p>

<pre><code>&lt;asp:Menu ID="categoryMenu" runat="server" EnableViewState="false"&gt;
&lt;/asp:Menu&gt;
</code></pre>

<p><code>EnableViewState</code> is only <strong>false</strong> because it didn't work with <strong>true</strong> either.</p>
