How to get item from data list source???

M

Mary Kerrigan

OK - I've been wrestling with this all day: I have a DataList:

<asp:DataList id="MyList" runat="server" OnItemCommand="pickCat">
<ItemTemplate>
<asp:LinkButton id="myLink" Text='<%# Container.DataItem(
"Subject" ) %>' CommandArgument='<%# Container.DataItem( "Subject" )
%>' Runat="Server"/>
</ItemTemplate>
<SelectedItemTemplate>
<b><%# Container.DataItem( "Subject" ) %></b>
</SelectedItemTemplate>
</asp:DataList>

How do I reference the (selected) dataitem "SubjectID" in the
code-behind????? This is different from "Subject" - it's in the same
DataSet.

Thanks
 
C

Chris Jackson

The SelectedItem property of the DataGrid type will give you the
DataGridItem object representing this item, and you can use the DataItem
property of this.
 

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

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top