Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 :
XML
<%@ 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>
Posted
Updated 5-Oct-12 4:29am
v3

1 solution

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.
 
Share this answer
 
v4
Comments
zaid Qureshi 5-Oct-12 9:28am    
dear marcus kramer can u be more precise and clear..
fjdiewornncalwe 5-Oct-12 9:39am    
I've updated the answer. Take a look.
zaid Qureshi 5-Oct-12 9:40am    
the below is my code...

plz help me with solving the error...



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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Report card</title>
<style type="text/css">
.style1
{
font-weight: bold;
font-size: large;
}
.style2
{
text-decoration: underline;
text-align: center;
width: 1199px;
height: 92px;
}
.style3
{
font-family: Miriam;
}
.style4
{
font-size: large;
}
</style>
</head>
<body style="font-weight: 700">
<form id="form1" runat="server">
<div>
<table>


<span class="style3">Report card</span>


<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Enter The Student name" CssClass="style1">
        
<asp:TextBox ID="TxtStudentname" runat="server" Style="font-size: large" Width="181px">
<asp:Label ID="Label7" runat="server" Text="*" ForeColor="#FF3300">
 <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please Enter The Name."
ControlToValidate="TxtStudentname" Font-Bold="True" Font-Size="Medium" ForeColor="#FF3300">
<br />
<td>
 
</td>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="Enter The Student Roll No" CssClass="style1">
    <asp:TextBox ID="TxtRollno" runat="server" CssClass="style4"
Width="185px">
<asp:Label ID="Label8" runat="server" Text="*" ForeColor="#FF3300">
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Please Enter the Roll No."
ControlToValidate="TxtRollno" Font-Bold="True" Font-Size="Medium" ForeColor="#FF3300">
<td>
 
</td>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label10" runat="server" Text="C" CssClass="style1">
                                                   
<asp:TextBox ID="TxtC" runat="server" CssClass="style1">
<asp:Label ID="Label13" runat="server" Text="*" ForeColor="#FF3300">
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Please Enter the Marks For C"
ControlToValidate="TxtC" Display="Dynamic" Font-Bold="True" ForeColor="#FF3300">
<asp:RangeValidator ID="RangeValidator2" runat="server" ControlToValidate="TxtC"
ErrorMessage="The Marks Should be less than or Equal to 100" Font-Bold="True"
fjdiewornncalwe 5-Oct-12 9:45am    
Could you use the "Improve Question" widget above and update your original question with the code. I'm thinking the comment method used has cut off some of the code because there are no databound controls in the code you pasted. If you put it in the question, I'll remove the code that isn't relevant and then I can help a little more.
zaid Qureshi 5-Oct-12 9:54am    
the updated code....

plz help me with solving the error...


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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Report card</title>
<style type="text/css">
.style1
{
font-weight: bold;
font-size: large;
}
.style2
{
text-decoration: underline;
text-align: center;
width: 1199px;
height: 92px;
}
.style3
{
font-family: Miriam;
}
.style4
{
font-size: large;
}
</style>
</head>
<body style="font-weight: 700">
<form id="form1" runat="server">
<div>
<table>


<span class="style3">Report card</span>


<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Enter The Student name" CssClass="style1">
        
<asp:TextBox ID="TxtStudentname" runat="server" Style="font-size: large" Width="181px">
<asp:Label ID="Label7" runat="server" Text="*" ForeColor="#FF3300">
 <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please Enter The Name."
ControlToValidate="TxtStudentname" Font-Bold="True" Font-Size="Medium" ForeColor="#FF3300">
<br />
<td>
 
</td>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="Enter The Student Roll No" CssClass="style1">
    <asp:TextBox ID="TxtRollno" runat="server" CssClass="style4"
Width="185px">
<asp:Label ID="Label8" runat="server" Text="*" ForeColor="#FF3300">
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Please Enter the Roll No."
ControlToValidate="TxtRollno" Font-Bold="True" Font-Size="Medium" ForeColor="#FF3300">
<td>
 
</td>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label10" runat="server" Text="C" CssClass="style1">
                                                   
<asp:TextBox ID="TxtC" runat="server" CssClass="style1">
<asp:Label ID="Label13" runat="server" Text="*" ForeColor="#FF3300">
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Please Enter the Marks For C"
ControlToValidate="TxtC" Display="Dynamic" Font-Bold="True" ForeColor="#FF3300">
<asp:RangeValidator ID="RangeValidator2" runat="server" ControlToValidate="TxtC"
ErrorMessage="The Marks Should be less than or Equal to 100" Font-Bold="True"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900