Accessing datasource from ItemCommand

3 posts, 1 answers
  1. Matt
    Matt avatar
    29 posts
    Member since:
    Oct 2011

    Posted 14 Nov 2011 Link to this post

    Seems like this should be simple, but I'm not seeing it.
    I have a RadListView displaying data from a table and I have LinkButtons on each item to delete them. Everything fires like I would expect but I'm having trouble in my ItemCommand event.

    In my ItemCommand event I just need to be able to access my "pri_key" column of the bound table.
    I'm used to doing something like e.Item.DataItem("pri_key") in other bound controls but I don't see anything like that.
    How should I be accessing this? Thanks!

    Thanks!
  2. Matt
    Matt avatar
    29 posts
    Member since:
    Oct 2011

    Posted 14 Nov 2011 Link to this post

    Well, I think I have it figured out by passing the key in the CommandArgument. I had tried this before, but putting quotes around the <%# %> tags was throwing an error. Omitting the quotes fixed it (which seems weird to be but whatever works!).

    If this is a bad approach please let me know, otherwise I think I'm ok on this!

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 15 Nov 2011 Link to this post

    Hello Matt,

    Your approach seems fine to me. Feel free to utilize it if appropriate.

    Best regards,
    Sebastian
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top