SelectedItemTemplate does not show in datalist

  • Thread starter Thread starter Raymond Du
  • Start date Start date
R

Raymond Du

Hi,

I have the following templates inside a datalist:

<SelectedItemTemplate>
&nbsp;<%# Container.DataItem("Title") %>
</SelectedItemTemplate>
<ItemTemplate>
&nbsp;<asp:LinkButton id="lnkAction" runat="server" cssClass="OtherTabs"><%#
Container.DataItem("Title") %></asp:LinkButton>
</ItemTemplate>


The Titles show up regular items. But when an item is selected, Title
disappears, I only see a blank space. I am sure Title has value because it
shows when the item is not selected.

Any Ideas?

TIA
 
Chances are, it has to do with the way you are binding or the way you are
setting the SelectedIndex. Could you post some more code (specifically, the
entire DataList declaration, as well as the code-behind methods that bind
your data and set the SelectedIndex value. From what you've posted, it looks
as if your code will work, therefore, it must be something in your code
which is causing the problem.

Thanks,
Johann MacDonagh
 
Back
Top