I'm using a code-behind function (called TestFx) in my binding expression. I'm passing a string and the function accepts a string but I still get a runtime error saying invalid args.
But if I change the method to accept an object and inspect the value, "it's a string!" Can someone please explain?
-rod
ProductDescription:
<asp:Label ID="ProductDescriptionLabel" runat="server"
开发者_开发知识库 Text='<%# TestFx(Eval("ProductDescription")) %>' />
<br />
Another option is to handle repeater control ItemDataBound event. It's more suitable if ItemTemplate elements require complex decoration
The return type of Eval is object. As you've noticed, you can either change the signature of your method to accept an object, or you can typecast the result of Eval("ProductDescription") to a string:
<asp:Label ID="ProductDescriptionLabel" runat="server"
Text='<%# TestFx(Eval("ProductDescription").ToString()) %>' />
加载中,请稍侯......
精彩评论