Databound Repeater question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a reapeater control with linkbutton controls in the item template
section.

An array of USER objects will be the data source and I want to embed USER.id
as the CommandArgument so that when the user clicks the button, she is
redirected to a url which includes the id string.

The code below doesn't parse the expression between the <%# *> tags when it
is embedded in the tag's attribute, but it's fine when the block is between
an open and end tag.

Can any one give a clue as to what's going on and how I might retain the Id
value for later use when responding to the link button's click event?

Thank You,
Keith Harris

==================================================
CODE:
==================================================
<asp:Repeater ID="repeaterLinkedAccounts" Runat="server"
OnItemCreated="repeaterLinkedAccounts_ItemCreated"
OnItemCommand="repeaterLinkedAccounts_ItemCommand">
<ItemTemplate>
<ul>
<li>
<asp:LinkButton
ID="linkbuttonLinkedUser"
Runat="server"
CommandName="showprofile"
CommandArgument="<%#DataBinder.Eval(Container.DataItem,"Id")%>">
<%#DataBinder.Eval(Container.DataItem,"FullName")%>
</asp:LinkButton>
</li>
</ul>
</ItemTemplate>
</asp:Repeater>
 
Are you getting a run-time error? Try single quotes around the databinding
expression (else conflicts with "Id").

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top