Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ListView > Accessing datasource from ItemCommand

Answered Accessing datasource from ItemCommand

Feed from this thread
  • Matt avatar

    Posted on Nov 14, 2011 (permalink)

    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!

    Reply

  • Matt avatar

    Posted on Nov 14, 2011 (permalink)

    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!

    Reply

  • Answer Sebastian Sebastian admin's avatar

    Posted on Nov 15, 2011 (permalink)

    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

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ListView > Accessing datasource from ItemCommand
Related resources for "Accessing datasource from ItemCommand"

ASP.NET ListView Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]