# I get the following error: “System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.” when I add a .Net UserControl to my web form

**URL:** <https://discuss.workflowgen.com/t/i-get-the-following-error-system-collections-generic-keynotfoundexception-the-given-key-was-not-present-in-the-dictionary-when-i-add-a-net-usercontrol-to-my-web-form/185>\
**Category:** Visual Studio Web Forms\
**Created:** [October 20, 2009, 5:29am UTC](https://discuss.workflowgen.com/t/i-get-the-following-error-system-collections-generic-keynotfoundexception-the-given-key-was-not-present-in-the-dictionary-when-i-add-a-net-usercontrol-to-my-web-form/185 "2009-10-20T05:29:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wfg-admin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/wfg-admin/32/714_2.png) [@wfg-admin](https://discuss.workflowgen.com/u/wfg-admin)\
**Post date:** [October 20, 2009, 5:29am UTC](https://discuss.workflowgen.com/t/i-get-the-following-error-system-collections-generic-keynotfoundexception-the-given-key-was-not-present-in-the-dictionary-when-i-add-a-net-usercontrol-to-my-web-form/185/1 "2009-10-20T05:29:00Z")

</div>

### Issue

I get the following error: `System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. when I add a .Net UserControl to my web form.`

### Solution

You will get this error if the registration of your UserControl to the WorkflowPage class is missing. This is only applicable in Advanced Mode, and not needed when you are in Simple Mode.

See the [Can I dynamically add a UserControl to my WorkflowGen web form?](https://discuss.workflowgen.com/t/can-i-dynamically-add-a-usercontrol-to-my-workflowgen-web-form/184) article for more information on form data definition and restiration of UserControls in Advanced Mode.
