Server Error in '/' Application

  • Thread starter Thread starter comptech111
  • Start date Start date
C

comptech111

Guest
hi

datasource and datalist:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:myCon %>"

SelectCommand="SELECT * FROM [news]" OnSelecting="SqlDataSource1_Selecting"></asp:SqlDataSource>

<br />
<asp:DataList ID="DataList1" runat="server" DataKeyField="id"
DataSourceID="SqlDataSource1" Font-Bold="False" Font-Italic="False"
Font-Overline="False" Font-Strikeout="False" Font-Underline="False"
HorizontalAlign="Right" RepeatColumns="2" RepeatDirection="Horizontal"
Height="1103px" OnSelectedIndexChanged="DataList1_SelectedIndexChanged">
<ItemTemplate>


<br />
<asp:Image ID="Image1" runat="server" Width="250" Height="150"
ImageUrl='<%# "imageHandler/ImgHandler1.ashx?id=" + Eval("id") %>' />
<br />
<h6 style="color:Red">myTilte: </h6>
<asp:Label ID="titleLabel" runat="server" Text='<%# Eval("title") %>' />
<br />
<h6 style="color:Red"> myBody: </h6>
<asp:Label ID="bodyLabel" runat="server" Text='<%# Eval("body") %>' />
<br />

<asp:HyperLink ID="HyperLink1"
NavigateUrl='<%# FormatUrl( (int) Eval("id")) %>' runat="server" Font-Underline="False">continue</asp:HyperLink>


<br />
<br />

<br />
<br />
</ItemTemplate>
</asp:DataList>



i have this error ,while Execute :

Server Error in '/' Application.

DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'id'.
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: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'id'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[HttpException (0x80004005): DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'id'.]
System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +2963837
System.Web.UI.WebControls.DataList.CreateControlHierarchy(Boolean useDataSource) +582
System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +65
System.Web.UI.WebControls.BaseDataList.DataBind() +84
System.Web.UI.WebControls.BaseDataList.EnsureDataBound() +62
System.Web.UI.WebControls.BaseDataList.CreateChildControls() +71
System.Web.UI.Control.EnsureChildControls() +97
System.Web.UI.Control.PreRenderRecursiveInternal() +42
System.Web.UI.Control.PreRenderRecursiveInternal() +163
System.Web.UI.Control.PreRenderRecursiveInternal() +163
System.Web.UI.Control.PreRenderRecursiveInternal() +163
System.Web.UI.Control.PreRenderRecursiveInternal() +163
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +906


many thanks

Continue reading...
 
Back
Top