How to get item from data list source???

  • Thread starter Thread starter Mary Kerrigan
  • Start date Start date
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
 
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.
 
Back
Top