views:

23

answers:

0

Hi,

I have a datagrid with a button in each row that when I click on it, it redirects to another page. I want to be able to click on the entire row and not on that button.

The problem is that now I go to database when I click on the button like so:

DataTable dt = DataAccessLayer.selectFromTable(reviewedGrid.Rows[e.NewSelectedIndex].Cells[0].Text)
string tools = dt.Rows[0][7].ToString();
Response.Redirect("Start.aspx?mode=" + dt.Rows[0][1].ToString());

But as I understand the only way to make the row clickable is through client side and in RowDataBound event. But in that event there are no rows existing in the datagrid, so when I try this code:

  DataTable dt = DataAccessLayer.selectFromTable(activeHPMGrid.Rows[e.Row.RowIndex].Cells[0].Text));
string tools = dt.Rows[0][7].ToString();
e.Row.Attributes.Add("onclick", "return blah(" + dt.Rows[0][1].ToString())");
e.Row.Attributes.Add("style", "cursor:hand");

It doesn't work because he doesn't have any rows in the event.

So, can I make it work somehow? maybe do it in some other event? or maybe do it in the server side somehow?

Thanks,

Greg