473,396 Members | 1,987 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,396 software developers and data experts.

Error when databinding

When I run my application, which uses databinding in a DataList, I recieve the following error:

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

Public member 'title' on type 'DataRowView' not found.
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.MissingMemberException: Public member 'title' on type 'DataRowView' not found.

Source Error:

Line 65: <ItemStyle Font-Names="Arial,Helvetica,Sans-Serif" BackColor="Silver"></ItemStyle>
Line 66: <ItemTemplate>
Line 67: <asp:HyperLink id=lnkTitle1 runat="server" NavigateUrl='<%# "viewpoem.aspx?poem=" &amp; Server.UrlEncode(Container.DataItem.title) %>' Text='<%# DataBinder.Eval(Container, "DataItem.title") %>' Width="400px" Font-Size="Medium">
Line 68: </asp:HyperLink>
Line 69: <asp:Label id=lblRating1 runat="server" Text="<%# FormatNumber(CDbl(Container.DataItem.totalpoints)/CDbl(Container.DataItem..timesrated),1,TriState.Tr ue) %>" Width="40px" Font-Size="Medium">

Source File: c:\inetpub\wwwroot\poetry\poemratings.aspx Line: 67

Stack Trace:

[MissingMemberException: Public member 'title' on type 'DataRowView' not found.]
Microsoft.VisualBasic.CompilerServices.LateBinding .LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack) +885
ASP.poemratings_aspx.__DataBind__control12(Object sender, EventArgs e) in c:\inetpub\wwwroot\poetry\poemratings.aspx:67
System.Web.UI.Control.OnDataBinding(EventArgs e) +66
System.Web.UI.Control.DataBind() +26
System.Web.UI.Control.DataBind() +86
System.Web.UI.WebControls.DataList.CreateItem(Int3 2 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) +127
System.Web.UI.WebControls.DataList.CreateControlHi erarchy(Boolean useDataSource) +686
System.Web.UI.WebControls.BaseDataList.OnDataBindi ng(EventArgs e) +49
System.Web.UI.WebControls.BaseDataList.DataBind() +23
localhost.poetry.poemratings.SortPoems(String sortby) in C:\Inetpub\wwwroot\poetry\poemratings.aspx.vb:59
localhost.poetry.poemratings.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\poetry\poemratings.aspx.vb:41
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032
I cannot figure out why this is happening. The code I use to do the binding, which I call from Page_Load using Me.SortPoems("title") is as follows:
Private Sub SortPoems(ByVal sortby As String)
Dim ratedpoems As New DataSet
Dim sqltext As String = "SELECT * FROM poemratings ORDER BY "

Select Case sortby
Case "title"
sqltext &= "title"
Case "rating"
sqltext &= "(totalpoints/timesrated),timesrated,title"
Case "timesrated"
sqltext &= "timesrated,(totalpoints/timesrated),title"
End Select
Dim dataadapterSelect As New System.Data.OleDb.OleDbDataAdapter(sqltext, Global.GetDBConnection())
dataadapterSelect.Fill(ratedpoems)
datRatings.DataSource = ratedpoems
datRatings.DataBind()
End Sub
I have tried several experiments (such as removing the databinding expressions that use the field, but the same thing happens with the other fields). Why is ASP.NET telling me the field is not there? Any help would be appreciated. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 21 '05 #1
1 1454
Nathan

Try it in this case with a datatable.

I hope this helps,

Cor
Nov 21 '05 #2

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

Similar topics

2
by: Chumley the Walrus | last post by:
I'm using a subroutine/helper function display an image (the image would be displayed inside a datalist control's <itemtemplate> ) <script language="VB" runat="server"> Public Sub...
1
by: Jonas Auken | last post by:
hi, I have a repeater which dynamically loads another usercontrol throught databinding: OnClick: DataBind() rptProduct_ItemDataBound: ViewSmall _viewSmall = (ViewSmall)...
4
by: dtblankenship | last post by:
Hello everyone, I know this question has been asked many times in the forums, and after spending a few days reading, I am still confused as to the answer. I have a ListBox (lstBox),...
6
by: Alan Silver | last post by:
Hello, I am data binding a repeater that has a checkbox in the ItemTemplate. The data value coming out of the database is a char(1) field containing either "y" or "n". I want to use this value...
6
by: Nathan Sokalski | last post by:
I am using a DataSet as the DataSource of a DataList in my code. The SQL used to get the data from the database begins with: SELECT...
1
by: Nathan Sokalski | last post by:
When I run my application, which uses databinding in a DataList, I recieve the following error: Server Error in '/' Application. ...
7
by: BS | last post by:
Hello everybody I'm calling a webservice that returns complex data. The goal is to populate a datagrid with it. Using a loop for each record found ( such as For i = 0 To...
2
by: Agnes | last post by:
I got a simple form and using databinding manager to do the add new Now , my big trobule is . I can update the 'addnew' record, However, after I new the record, and then amend it , it got...
0
by: JSantora | last post by:
Essentially, InsertAT is broken! For the past couple of hours, I've been getting this "Parameter name: '-2147483550' is not a valid value for 'index'." error. Apparently, its caused by having...
2
by: Vincent | last post by:
Hi, There are two related tables: one called 'group' and the other 'items'. Each item belongs to a group. The table 'group' is shown in a gridview with a linkbutton for deleting. When an user...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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,...

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.