数据绑定:"System.Data.DataRowView"不包含名称为"AspdotNet"的属性. [英] DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'AspdotNet'.

查看:56
本文介绍了数据绑定:"System.Data.DataRowView"不包含名称为"AspdotNet"的属性.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的..

我在代码中发现了这个小错误..请您帮我解决同样的问题

错误是:DataBinding:``System.Data.DataRowView''不包含名称为``AspdotNet''的属性

代码是:

dear all..

I am finding this minor error in my code..could u''ll pls help me in solving the same

the error is :DataBinding: ''System.Data.DataRowView'' does not contain a property with the name ''AspdotNet''

the Code is :

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

                    <asp:GridView ID="GridView1" runat="server" CellPadding="3" ForeColor="Black" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"

                        GridLines="Vertical" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowDeleted="GridView1_RowDeleted"

                        OnRowEditing="GridView1_RowEditing1" OnRowUpdating="GridView1_RowUpdating" BackColor="White"

                        BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" OnRowDeleting="GridView1_RowDeleting">
                        <AlternatingRowStyle BackColor="#CCCCCC" />
                        <Columns>
                            <asp:ButtonField CommandName="Delete" Text="Delete" HeaderText="Delete" />
                            <asp:ButtonField CommandName="Edit" Text="Edit" HeaderText="Edit" />
                            <asp:ButtonField CommandName="Update" Text="Update" HeaderText="Update" />
                            <asp:ButtonField CommandName="Cancel" Text="Cancel" HeaderText="Cancel" />
                            <asp:TemplateField HeaderText="Name">
                                <ItemTemplate>
                                    <asp:TextBox ID="txtStudentName" runat="server" Text='<%#Eval("Name")%>'> </asp:TextBox>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText=" Student Roll No">
                                <ItemTemplate>
                                    <asp:TextBox ID="txtRollNo" runat="server" Text='<%#Eval("RollNo")%>'> </asp:TextBox>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText=" C Marks">

                                <ItemTemplate>
                                    <asp:TextBox ID="txtC" runat="server" Text='<%#Eval("Cmarks")%>'> </asp:TextBox>
                                </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField Headertext=" C++ Marks">
                            <ItemTemplate>
                             <asp:TextBox ID="txtCplusplusMarks" runat="server" Text='<%#Eval("CplusplusMarks")%>'> </asp:TextBox>
                            </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField Headertext=" C# Marks">
                            <ItemTemplate>
                             <asp:TextBox ID="txtCsharpMarks" runat="server" Text='<%#Eval("C#Marks")%>'> </asp:TextBox>
                            </ItemTemplate>
                            </asp:TemplateField>

                           <asp:TemplateField Headertext=" ASP.Net Marks">
                            <ItemTemplate>
                             <asp:TextBox ID="txtAspdotnet" runat="server" Text='<%#Eval(" ASP dot Net Marks")%>'> </asp:TextBox>

                            </ItemTemplate>
                            </asp:TemplateField>

                           <asp:TemplateField Headertext=" Marks Obtained">
                            <ItemTemplate>
                                <asp:Label ID="Label9" runat="server" Text='<%#Eval("MarksObtained")%>'>></asp:Label>

                            </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField Headertext=" Total Marks">
                            <ItemTemplate>
                                <asp:Label ID="Label17" runat="server" Text='<%#Eval("TotalMarks")%>'></asp:Label>

                            </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField Headertext=" Percentage">
                            <ItemTemplate>
                                <asp:Label ID="Label18" runat="server" Text='<%#Eval("Percentage")%>'></asp:Label>

                            </ItemTemplate>

                        </Columns>
                        <FooterStyle BackColor="#CCCCCC" />
                        <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
                        <SortedAscendingCellStyle BackColor="#F1F1F1" />
                        <SortedAscendingHeaderStyle BackColor="Gray" />
                        <SortedDescendingCellStyle BackColor="#CAC9C9" />
                        <SortedDescendingHeaderStyle BackColor="#383838" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server"></asp:SqlDataSource>

推荐答案

,这意味着您在视图中试图绑定到一个名为"AspdotNet"的值,但是该值在您要绑定到的数据中不存在.
确保绑定正确无误,并且此错误会像dodo一样发生. (那些没有得到参考的人的绝种鸟)

更新:
我会尝试更清楚:
1)您的UI中有一个数据绑定列.
2)该数据绑定列试图绑定到数据中名为"AspdotNet"的列.
3)您要绑定到的数据中不存在"AspdotNet".
4)这就是引发错误的原因.
更新2:
我很确定这个#Eval(" ASP dot Net Marks";)不会起作用.我很确定您来自数据库的列名不是这个.检查您的数据源列名称,并确保该名称与您要显示的列名称完全匹配.
It means that in your View you are trying to bind to a value called "AspdotNet", but this value does not exist in the data you are binding to.
Ensure that your bindings are all correct and this error will go the way of the dodo. (The extinct bird for those who don''t get the reference)

Update:
I''ll try to be more clear:
1) You have a databound column in your UI.
2) That databound column is trying to bind to a column in your data called "AspdotNet".
3) "AspdotNet" does not exist in the data you are binding to.
4) That is why the error is being thrown.

Update 2:
I''m pretty sure that this #Eval(" ASP dot Net Marks";) isn''t going to work. I''m pretty sure that your column name coming from the database is not this. Check your datasource column names and make sure that this one matches exactly the column name you are trying to show.


这篇关于数据绑定:"System.Data.DataRowView"不包含名称为"AspdotNet"的属性.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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