Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
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>
Posted 5-Oct-12 3:21am
Edited 5-Oct-12 4:29am
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
v4
Comments
zaid Qureshi at 5-Oct-12 9:28am
   
dear marcus kramer can u be more precise and clear..
Marcus Kramer at 5-Oct-12 9:39am
   
I've updated the answer. Take a look.
zaid Qureshi at 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"
Marcus Kramer at 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 at 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"
zaid Qureshi at 5-Oct-12 10:00am
   
help me marcus...
Marcus Kramer at 5-Oct-12 10:07am
   
I'm trying to help you. Please follow the instructions I'm giving you.
At the top of this page, on the right hand side you will find a green link "Improve Question". Please use that to paste your code into your question. Putting the code into the comments here isn't useful because there is too much to look at that way.
Marcus Kramer at 5-Oct-12 10:34am
   
See Updated answer.

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

  Print Answers RSS
0 Richard MacCutchan 335
1 OriginalGriff 310
2 Sergey Alexandrovich Kryukov 207
3 Sharmanuj 146
4 Magic Wonder 129
0 Sergey Alexandrovich Kryukov 5,999
1 OriginalGriff 5,115
2 CPallini 2,473
3 Richard MacCutchan 1,597
4 Abhinav S 1,505


Advertise | Privacy | Mobile
Web02 | 2.8.140814.1 | Last Updated 5 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100