views:

772

answers:

2

Does anyone know how i can get the grid to select a row by clicking on any cell in the row?

The only way i can do this at the moment is by setting the AutoGenerateSelectButton property to True, but this adds a column to the grid with a crude "select" hyperlink and only selects the row if the word "Select" is cliked on.

Surely there has to be a better way!?!?

NOTE - I do not use C#

+3  A: 

You need to add some javascript to the row in RowDataBound

   e.Row.Attributes["onclick"] = 
                    ClientScript.GetPostBackClientHyperlink
                        (this.GridView1, "Select$" + e.Row.RowIndex);

There's a CodeProject article about it here, which goes into much more detail.

Phil Jenkins
is there a VB.net example i could use as I dont use c# :(
eMTeeN
My VB syntax is a bit rusty - but the basic idea is add the JS to the onclick attribute of the row - in the RowDataBound handler, something likee.Row.Attributes.Add("onclick", ClientScript.GetPostBackClientHyperlink(Me.GridView1, "Select$"
Phil Jenkins
A: 

And if do not want to write any code check out the client-side selection of the Telerik grid. I am pretty content with it when using it during my web development.

Dick