Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2070
Referencing current row (or row num) in ItemCommand
posted

I've looked at pages and pages of documentation and forum threads, but I can't seem to get around this issue. Using the WebDataGrid (.NET 3.5) I have a grid with nine or so templated columns. The first column template is a LinkButton; I have that set up for an ItemCommand to process it (gets the detail data and displays it on another web page). I have my CommandName set up, and what I need to do is either pass the container for that row, or the row index, back to the server side ItemCommand method so I can grap some other fields from that row. Basically, in ItemCommand I need to know what row that LinkButton was clicked.

I've tried everything to get the CommandArgument to pass back the record number but nothing works. I tried the idea presented in another thread, using:

CommandArgument="<%# Container.Cell.Row.Index %>"

but that always gives back the error 'Cell' is not a member of 'System.Web.UI.Control'.

So my big question is: In ItemCommand (for a WebDataGrid) how can I either get the current row that the LinkButton was click on (in ItemCommand), or at least get passed back the row index?

I'm frustrated... hope someone can help. Thx.

/Tom

Parents Reply Children