I am dynamically creating a table which I want to have clickable rows. When the user clicks on one of the rows I want to redirect to a page specific to the item of that row. My question is how on the server side can I wire the ‘onclick’ event to a routine that will then allow me to build a url based on some of the data included in the row they clicked?
for example I would want to do this on click:
Response.Redirect('SomePage.aspx?' itemType + '&' + COLUMN1VALUE);
where COLUMN1VALUE would be the first column in the row that was clicked.
It sounds like your actual goal is simply to display/edit the row on another page. If this is the case, you could simply add a javascript event handler to the table row when you create it.
If you use a GridView to create the table you can inject this in the RowDataBound event:
Unless you need to do something in the postback, there is no need to redirect. Further, you could just create a hyperlink when you create the row eliminating the need for javascript, you don’t need the full row clicking experience.