SelectedItemTemplate does not show in datalist

Discussion in 'ASP .Net' started by Raymond Du, Dec 5, 2004.

  1. Raymond Du

    Raymond Du Guest

    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
     
    Raymond Du, Dec 5, 2004
    #1
    1. Advertising

  2. 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

    "Raymond Du" <> wrote in message
    news:eyRw%...
    > 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
    >
    >
     
    Johann MacDonagh, Dec 5, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Randy Vande Hei
    Replies:
    0
    Views:
    593
    Randy Vande Hei
    Aug 4, 2003
  2. Dirk Meusel
    Replies:
    1
    Views:
    3,023
    Dirk Meusel
    Aug 19, 2003
  3. Randy Vande Hei

    datagrid within SelectedItemTemplate of another grid

    Randy Vande Hei, Aug 4, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    124
    Randy Vande Hei
    Aug 4, 2003
  4. Steve Klett

    <selectedItemTemplate>

    Steve Klett, Nov 17, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    194
    Steve Klett
    Nov 19, 2003
  5. Kim Søvsø Pedersen

    Datalist SelectedItemTemplate problem

    Kim Søvsø Pedersen, Oct 19, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    366
    Kim Søvsø Pedersen
    Oct 19, 2005
Loading...

Share This Page