Tuesday, March 9, 2010

EDM designer in Visual Studio: "The operation could not be completed. The parameter is incorrect"

When trying to open a .edmx file in VS, it throws this error:

Solution: open the designer as plain xml and remove children of edmx:Diagrams/Diagram node.

EDM: Error 11011: Association End key property 'Id' is not mapped.

Problem: receiving this error when building a project that includes an EDM:
Error 11011: Association End key property 'Id' is not mapped.
Solution: open as plain xml the .edmx file, remove everything related to the entity causing the error, then open the model with the designer and "Update model from database..." After you build, you should not get this error anymore.

Thursday, March 4, 2010

MVC & ViewState don't work together

It seems that postbacks are not supported in MVC. I found this article, and tried to address this issue in order to use some Ajax controls that do require form tags for including a ScriptManager, which cause postbacks.

In short - it worked correctly, with one tweak: instead of
public class ViewUserControlWithoutViewState<T> : ViewUserControl<T> where T : class 
I changed to:
public class ViewUserControlWithoutViewState : ViewUserControl
Otherwise, ASP.Net was not finding the type. Why? Didn't dig into more, but it may be related to Reflection not resolving correctly when where keyword is being used.

BTW - this is the control I was trying to use (needs Ajax Controls Toolkit):
    <form id="Form1" runat="server">
<asp:ToolkitScriptManager ID="asm" runat="server" />
<asp:LinkButton ID="linkButton1" runat="server" Text="Show Popup" />
<asp:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="linkButton1" ConfirmText="Want it or not?" />