473,382 Members | 1,322 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,382 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 3792

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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.