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.Data Item,"Id")%>">
<%#DataBinder.Eval(Container.DataItem,"FullName")% >
</asp:LinkButton>
</li>
</ul>
</ItemTemplate>
</asp:Repeater> 2 2126
Are you getting a run-time error? Try single quotes around the databinding
expression (else conflicts with "Id").
Bill
"Keith Harris" wrote: 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.Data Item,"Id")%>"> <%#DataBinder.Eval(Container.DataItem,"FullName")% > </asp:LinkButton> </li> </ul> </ItemTemplate> </asp:Repeater>
Exactly right Bill! Thanks so much for helping me see the problem.
-Keith
"Bill Borg" wrote: Are you getting a run-time error? Try single quotes around the databinding expression (else conflicts with "Id").
Bill
"Keith Harris" wrote:
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.Data Item,"Id")%>"> <%#DataBinder.Eval(Container.DataItem,"FullName")% > </asp:LinkButton> </li> </ul> </ItemTemplate> </asp:Repeater> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Phil Townsend |
last post by:
I want to add a datalist to a Repeater control. The data for the
datalist resides in a cached DataSet that contains two related tables.
The data in last child table should be rendered in three...
|
by: simon |
last post by:
I have dataRepeater and I use its dataBound event:
Private Sub rprPlists_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.RepeaterItemEventArgs) Handles...
|
by: darrel |
last post by:
*sigh*...I've asked this before, but have long forgotten the answer.
In the past, I'd often use repeater controls, bind data to it, and then
reference the data fields from within the repeater:
...
|
by: Rod Snyder |
last post by:
I'm trying to figure out how to set the selected item of databound
radiolistbutton once they are in a repeater (i.e. I want one item
pre-selected instead of nothing selected). In the html there is...
|
by: Andrew |
last post by:
Hi,
I am working on a questionnaire. I have displayed a questionnaire using a
repeater control. The itemtemplate is as below (quite cut down):
<ItemTemplate>
<tr><td>
<%#...
|
by: Igor |
last post by:
Hi all,
I've had these pages that I wrote in php that are used for executing varoius
queries. Query results are displayed as tables.
Since these tables can be pretty big I'like to give user some...
|
by: Brian |
last post by:
Using external XML, I'm trying to build a quiz, but I can't seem to specify the DataSource for the
RadioButtonList within a Repeater ItemTemplate.
I've tried a number of approaches, but I haven't...
|
by: Paul |
last post by:
Hi all,
I have a user control that contains a repeater that generates a list of
check boxes. The checkboxes render fine, but they don't maintain their
checked state on postback.
I've tried...
|
by: Håkan |
last post by:
Hi!
How do you format the href field of the <a>-tag when you use a databound
BulletedList in Hyperlink mode?
The field in the database contains an ID that I want to use as a parameter
in the...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |