sorry
e.Row.Attributes.Add("oncl
Main Topics
Browse All TopicsI'm able to highlight a Gridview row when clicking on it by inserting client-side Javascript, but what I need to do is simulate clicking the Select button by clicking anywhere in a row, preferably without a visible Select button. Any ideas?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi Proactivation,
This is a good question... I'll be very interested in what the final outcome becomes. In my thinking there are two approachs to accomplish this task.
1) Have a Submit button for each row. I believe you could make the button hidden, but it's important that it exists, so you can use it to launch a click() event. Basically you would add a JavaScript onClick event for the row that would execute the submit button for that row. If you knew which control index it was, you could do something like:
e.Row.Attributes.Add("onCl
There are probably a variety of ways to accomplish this first idea.
2) You launch the __doPostBack(eventTarget, eventArgument) yourself in the JavaScript onClick event. To me, this is less clean, but might be a viable solution if all else fails.
Let me know what you think...
-- Jason
Hi Jason
Interesting ideas! I've managed to get it going using the "messy" 2nd method, but I'd still like to get it going using proper events. It looks like there's a useful MouseUp event and Select method on Datagrids, but I can't find the equivalent for Gridviews. Thanks for helping me get this far.
Woohoo -- got it. It was actually pretty darn easy... #1 solution.
I had the Submit button in an TemplateField, that looked like this:
<asp:button style="display: none" runat="Server" Text="Select" ID="Button1" />
Notice the "display: none". This keeps it hidden, yet on the page.
Then in our code-behind in the RowDataBound event:
e.Row.Attributes.Add("onCl
Too easy!
-- Jason
Wow, two solutions for the price of one! It's a shame they're both workarounds for the apparent lack of suitable events, but I've got a feeling I'll be using this one quite a bit in future. Thanks - you've been great!
Note for the googlers: Don't forget to add CommandName="Select" to the button definition above so it knows it's a select button.
Business Accounts
Answer for Membership
by: lem2802Posted on 2006-02-13 at 10:03:21ID: 15943411
in the RowDataBound Event...
Color", "Red")
e.Row.Attributes.Add("Back