asp:DataGrid ... how do I allow any click on the row to select an item

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi,

First off .. I am very new to ASP.NET (.NET in general), so this may be a
very basic question.

I want the user to click anywhere on a row to select an item. I have seen
samples where I can add a LinkButton, but I would prefer the user to click
anywhere on the row. Any ideas would be appreciated.

Thanks in advance,
John
 
John,

You need to handle ItemDataBound event on the server side. The events is
fired for every row (item) in the grid. Ignore non-data items like the
header and the footer. For the data items set attribute "onclick" to
"myOnClickHandler(this)", where myOnClickHandler is a client-side javascript
function. Inside this function you can set the row style to whatever you
want

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top