Brandon Montgomery
Brandon Montgomery

Reputation: 6986

How to databind a property on a custom user control?

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?

Upvotes: 0

Views: 199

Answers (1)

andrei m
andrei m

Reputation: 1157

Try ' instead of " for the server tag

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

Upvotes: 4

Related Questions