a field or property with the name 'PageID' was not found on the selected data source - ALIAS

my line in gridview

<asp:Label ID="Label2" runat="server" Text='<%# new System.Text.StringBuilder("<a href=\"/Administration/Pages/EditPage/?pageID=").Append(Eval("PageID")).Append("\">").Append(Eval("Name")).Append("</a>").ToString() %>'></asp:Label>

fails with

Exception Details: System.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'PageID'.

i suspect the issue is the alias in datasource

SelectCommand="SELECT Menus.ID, Menus.ParentID, Menus.Name, Menus.Slug, Menus.PageTitle, Menus.PageSubTitle, Menus.MenuOrder, Menus.IsHomePage, Menus.IsYourAccountLink, Menus.IsMiniMenu, Menus.IsFooterMenu, Menus.IsHeaderMenu, Menus.CustomerID, Customers.SubDomain, PublicPages.ID AS PageID FROM Menus INNER JOIN Customers ON Menus.CustomerID = Customers.ID INNER JOIN PublicPages ON Menus.ID = PublicPages.HeaderMenuID AND Customers.ID = PublicPages.CustomerID WHERE (Menus.CustomerID = @CustomerFilter)"

so how to use it as the alias in:

Append(Eval("PageID"))

thnx

Answers


Try this one,

<%# Container.DataItem.GetColumn("PageId")%>

UPDATE1: A second option

<%#DataBinder.Eval(Container.DataItem.GetColumn("PageId"))%> 

Need Your Help

How to simulate typing in input to make angular filter work

javascript jquery angularjs input filter

For example I have list of countries &lt;div class="container" ng-init="