473,406 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

DataBinder.Eval Error!


Subject: DataBinder.Eval Error!

Server Error in '/MSPOS' Application.

------------------------------------------------------------------------
--------

DataBinder.Eval: 'System.Data.Common.DbDataRecord' does not contain a
property with the name REPORTTO.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Web.HttpException: DataBinder.Eval:
'System.Data.Common.DbDataRecord' does not contain a property with the
name REPORTTO.
Please email me at mc*****@sun.net.bb
I have done the following:
1) Modified my datagrid:
<asp:TemplateColumn HeaderText="Reports To">
<ItemTemplate>
<%# Convert.ToString(DataBinder.Eval(Container.DataIte m, "REPORTTO")) %>
</ItemTemplate>
<FooterTemplate>
<asp:DropdownList id="insertReportTos" DataSource='<%# BindUserNames()
%>' DataTextField="REPORTTO" DataValueField="REPORTTOID" runat="server">
</asp:DropdownList>
</FooterTemplate>
<EditItemTemplate>
<asp:DropdownList runat="server" id="ddlReportTos" DataSource='<%#
BindUserNames() %>' DataTextField="REPORTTO" DataValueField="REPORTTOID"
selectedindex='<%#
GetSelectedIndexReportsTo(DataBinder.Eval(Containe r.DataItem,
"REPORTTO").ToString())%>'>
</asp:DropdownList>
</EditItemTemplate>
</asp:TemplateColumn>

Now in my datagrid

SELECT USERID,REPORTTOID,USERNAME,GetUserName(REPORTTOID) AS REPORTTO
FROM TBUSERS

With the above SQL statement. Now I must incorporate it in the
datagrid.
private DataSet BindUserNames()
{
// Populate the ddlDataSet
OdbcConnection myConnection = new
OdbcConnection("DSN=POS;UID=system;PWD=system");
myConnection.Open();
const string strSQLDDL = @"SELECT
USERID,REPORTTOID,USERNAME,GetUserName(REPORTTOID) AS REPORTTO FROM
TBUSERS";
OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL,
myConnection);
ddlDataSet3.Clear();
myDataAdapter.Fill(ddlDataSet3, "ddlReportTos");
myDataAdapter.Dispose();
myDataAdapter = null;
// In next 2 lines, Dispose removes connection string info, Close is
better.
// Use one or the other, but not both...
// myConnection.Dispose();
myConnection.Close();
return ddlDataSet3;
}
But then I get this error when I run the program:

Server Error in '/MSPOS' Application.
------------------------------------------------------------------------
--------

DataBinder.Eval: 'System.Data.Common.DbDataRecord' does not contain a
property with the name REPORTTO.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Web.HttpException: DataBinder.Eval:
'System.Data.Common.DbDataRecord' does not contain a property with the
name REPORTTO.

Source Error:
Line 567: <asp:TemplateColumn HeaderText="Reports To">
Line 568: <ItemTemplate>
Line 569: <asp:Label id="lblReporTo" Runat="server" Text='<%#
Convert.ToString(DataBinder.Eval(Container.DataIte m,"REPORTTO")) %>'>
Line 570: </asp:Label>
Line 571: </ItemTemplate>
Source File: C:\Inetpub\wwwroot\MSPOS\Administrators.aspx Line: 569

Stack Trace:
[HttpException (0x80004005): DataBinder.Eval:
'System.Data.Common.DbDataRecord' does not contain a property with the
name REPORTTO.]
System.Web.UI.DataBinder.GetPropertyValue(Object container, String
propName) +147
System.Web.UI.DataBinder.Eval(Object container, String[]
expressionParts) +71
System.Web.UI.DataBinder.Eval(Object container, String expression)
+82
ASP.Administrators_aspx.__DataBind__control50(Obje ct sender,
EventArgs e) in C:\Inetpub\wwwroot\MSPOS\Administrators.aspx:569
System.Web.UI.Control.OnDataBinding(EventArgs e) +66
System.Web.UI.Control.DataBind() +26
System.Web.UI.Control.DataBind() +86
System.Web.UI.Control.DataBind() +86
System.Web.UI.WebControls.DataGrid.CreateItem(Int3 2 itemIndex, Int32
dataSourceIndex, ListItemType itemType, Boolean dataBind, Object
dataItem, DataGridColumn[] columns, TableRowCollection rows,
PagedDataSource pagedDataSource) +169
System.Web.UI.WebControls.DataGrid.CreateControlHi erarchy(Boolean
useDataSource) +1411
System.Web.UI.WebControls.BaseDataList.OnDataBindi ng(EventArgs e) +49
System.Web.UI.WebControls.BaseDataList.DataBind() +23
ASP.Administrators_aspx.BindData() in
C:\Inetpub\wwwroot\MSPOS\Administrators.aspx:153
ASP.Administrators_aspx.Page_Load(Object sender, EventArgs e) in
C:\Inetpub\wwwroot\MSPOS\Administrators.aspx:38
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
0 3796

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: bg | last post by:
Hi! How do I check if "date" exists before using that code? I've built a RSSreader and sometimes there's a date in it and sometimes not. How can I check if it exists to avoid crash...
4
by: Søren Lund | last post by:
Hello, I am trying to bind a DataGrid with some data from a DataSet which contains fields in the form "group.fieldname". I am certain that my data source contains the field but I cannot get my...
0
by: MS | last post by:
I am very new to asp.net. Please help me in resolving the error: DataBinder.Eval: 'System.Data.DataRowView' does not contain a property with the name RENEW_EXIST. I get the above error with the...
1
by: Mike Lerch | last post by:
Pretty much, TSIA, but I'll expand a bit: I'm still trying to get my head around the n-tier approach to web design. It seems to me that when you use DataBinder.Eval in the ASPX that your tiers...
2
by: jack | last post by:
Hello, I have a date in a SQL Database and want to use the dateformat tools to format the output. I am now using the Month, Day, and Year to do it now. I want to change: Released Date:...
2
by: Oleg Ogurok | last post by:
Hi all, I have a DatePicker ASP.NET control that allows users to enter date (e.g. a calendar control). The control has the following property public DateTime Value { get; set; } I've placed...
1
by: Nathan Sokalski | last post by:
I want to make an email link using databinding. I am able to get and display the email address from the database it is stored in using databinding as follows: <asp:HyperLink id="lnkEmail1"...
2
by: Lam | last post by:
hi I wrote a aspx page in c#. It execute the query to SQL 2000 database and return a DataTable table, bind it to the DataGrid and display on the screen. The page refresh every 10 seconds. it has...
4
by: CharlesA | last post by:
a general question... I'm a bit mystified by Databinder.eval(object, Colname, ) if controls can be bound to their individual data sources within the load event of the page... why would we ever...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.