具有Asp.net formview问题的实体框架。 [英] Entity framework with Asp.net formview problem.

查看:79
本文介绍了具有Asp.net formview问题的实体框架。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下生成的formvew代码。我总是得到Object引用null错误。

I have the following generated formvew code.And I always get Object reference null error.

如果我注释掉vendorID文本框我得到 对此控件禁用插入。

if i comment out the vendorID textbox i got Insert is disabled for this control.


    <asp:FormView ID="fvComments" runat="server" DataKeyNames="FeedBackID" DataSourceID="EntityDataSource3"
        DefaultMode="Insert">
        <InsertItemTemplate>
            <br />
            Comments:
            <asp:TextBox ID="CommentsTextBox" runat="server" Text='<%# Bind("Comments") %>' />
            <br />
            Name:
            <asp:TextBox ID="FeedbackNameTextBox" runat="server" Text='<%# Bind("FeedbackName") %>' />
            <br />
            Vendor.VendorID:
            <asp:TextBox ID="Vendor_VendorIDTextBox" runat="server" Text='<%# Eval("[Vendor.VendorID]") %>' />
            <br />
            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                Text="Insert" />
            &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False"
                CommandName="Cancel" Text="Cancel" />
        </InsertItemTemplate>


推荐答案

你好YDBN,
这里)。如果这是导致问题的原因,请不要确定问题的描述。

谢谢,
迭戈
Hello YDBN,

I think I already answered a related question, although with a different exception. Here again, I see at first glance that the Eval expression for Vedor.VendorID has square brackets. This is a known problem that is going to be resolved in ASP.NET 4.0, and the workaround is to manually remove the square brackets from the markup (you can read more about this issue here). Not sure from your description of the issue if this was the cause of the problem.

Thanks,
Diego


这篇关于具有Asp.net formview问题的实体框架。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆