0

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 Answers 3

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

is there a VB.net example i could use as I dont use c# :(
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 like e.Row.Attributes.Add("onclick", ClientScript.GetPostBackClientHyperlink(Me.GridView1, "Select$" & e.Row.RowIndex));
2

This is ancient, but here is the VB.NET equivalent:

Dim cs As ClientScriptManager = Page.ClientScript
Dim postbacklink As String = cs.GetPostBackClientHyperlink(lbtnSelectRow, "")

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.