Pass Parameter to DataList Datasource!

G

Guest

Hi all,

I am trying pass a value to the DataSource method in a DataList like below.
DataSource = <%# GetData(DataBinder.Eval(Container.DataItem, "ID"))%>"

I get an error with this code, and am wondering if someone can show me the
correct syntax.

I have asked this question before, but unfortunately i don't remember the
correct syntax.

I know i can acheive the desired result using code behind 'ItemDataBound',
but am prefering to do it in the aspx page itself..

All help appreciated.

<asp:DataList ID="dlTest"
DataKeyField = "ID"
DataSource = <%# GetData(DataBinder.Eval(Container.DataItem,
"ID"))%>">
<ItemTemplate><%# DataBinder.Eval(Container.DataItem,
"Name")%></ItemTemplate>
</asp:DataList>

Cheers,
Adam
 
E

Eliyahu Goldin

DataSource should be set to an on object containing data items. What is it
in your case?
 

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

Top