简体   繁体   中英

Databinding inside frendly url

This is inside a repeater.

Databinding does not work inside the friendlyurl but works fine outside. ProductName works but not ProductID. Friendly url works fine if i hardcode the ProductID

<li><a href="<%: FriendlyUrl.Href("~/Product", DataBinder.Eval(Container.DataItem, "ProductID")) %>"><%# DataBinder.Eval(Container.DataItem, "ProductName") %></a></li>

i get this error.

The name 'Container' does not exist in the current context

the Container word inside the friendlyurl is red underlined in visual studio

如果更改为(请注意#),则此方法应该有效...

<%# FriendlyUrl.Href("~/Product", DataBinder.Eval(Container.DataItem, "ProductID")) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM