开发者

How to databind a property on a custom user control?

开发者 https://www.devze.com 2023-01-27 16:16 出处:网络
I have a custom user control UserProfileLink on which I have two basic string properties, UID and UserFullName which I would like to use in a template column in a DataGrid like this:

I have a custom user control UserProfileLink on which I have two basic string properties, UID and UserFullName which I would like to use in a template column in a DataGrid like this:

....
<ItemTemplate>
  <td:UserProfileLink ID="uplUser" runat="server" UID="<%#Eval("UserUID") %>" UserFullName="<%#Eval("UserFullName") %>" />
</ItemTemplate>
....

I get an error saying开发者_运维技巧 "The server tag is not well formed" which leads me to believe this type of binding isn't possible. Is there a way to do this, or is it impossible?


Try ' instead of " for the server tag

<td:UserProfileLink ID="uplUser" runat="server" UID='<%#Eval("UserUID") %>' UserFullName='<%#Eval("UserFullName") %>' />

0

精彩评论

暂无评论...
验证码 换一张
取 消