How to get item from data list source???

Discussion in 'ASP .Net' started by Mary Kerrigan, Dec 2, 2003.

  1. 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
     
    Mary Kerrigan, Dec 2, 2003
    #1
    1. Advertising

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


    --
    Chris Jackson
    Software Engineer
    Microsoft MVP - Windows Client
    Windows XP Associate Expert
    --
    More people read the newsgroups than read my email.
    Reply to the newsgroup for a faster response.
    (Control-G using Outlook Express)
    --

    "Mary Kerrigan" <> wrote in message
    news:...
    > 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
     
    Chris Jackson, Dec 3, 2003
    #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. Shahid Saleem
    Replies:
    1
    Views:
    748
    =?Utf-8?B?RWx0b24gVw==?=
    Aug 26, 2005
  2. Johannes Zellner
    Replies:
    1
    Views:
    509
    Alex Martelli
    Jan 17, 2006
  3. Author Tarun Tyagi
    Replies:
    0
    Views:
    736
    Author Tarun Tyagi
    Dec 29, 2004
  4. =?Utf-8?B?bXVuaQ==?=
    Replies:
    0
    Views:
    565
    =?Utf-8?B?bXVuaQ==?=
    Aug 2, 2007
  5. QUASAR
    Replies:
    6
    Views:
    448
    QUASAR
    Jan 17, 2004
Loading...

Share This Page