[RESOLVED] navigate pages through datagrid item
*control naming error its Gridview not datagrid
Hi, I have search page using gridivew with boundfield on it. And I want to do something extra by making the full row clickable instead of having hyperlink control in specific column or make the image a hyperlink itself. I've read some post regarding CellContentClick but not really sure how to use it. Other use AJAX... not my option at the moment as I want to keep the code simple for simple task.
http://img820.imageshack.us/i/img1e.gif/
Re: navigate pages through datagrid item
Re: navigate pages through datagrid item
hi gary,
Not really, my apology if i get you lost. Take this sample
Code:
DirectCast(e.Row.FindControl("showbutton"), Button).Attributes.Add("onclick", "window.open('mrecipe.aspx?id=" & e.Row.DataItem("pk_id").ToString & "','_self'); return false;")
basically i use the showbutton for transferring details to other page but instead of having that i want to use the entire row to fire to raise a navigation event.
Thanks.
Re: navigate pages through datagrid item
Ok, this is simply an extension of the code that I linked to.
The example show how to make the whole row clickable, so once you have that, you just exchange in your code.
Gary
Re: navigate pages through datagrid item
hey, thanks for the web ref. it was a good start.
eventually i end up with the simplest code, something like these. only that i hook up row data for building querystring. :D
Code:
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Attributes.Add("onclick", "javascript:window.location='my_url?q=" & e.row.dataitem("fld").tostring &";")
'add hlink cursor effect
e.Row.Attributes.Add("onmouseover", "javascript:this.style.cursor='pointer';")
e.Row.Attributes.Add("onmouseout", "javascript:this.style.cursor='default;")
End If
cheers.
Re: navigate pages through datagrid item
Sounds like you have a solution :)
Can you remember to mark your thread as resolved?
Gary