Click here to Skip to main content
15,920,661 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear, I am trying to open a div on clicking the data in a row of a table.
Please help me out with this.
Posted

1 solution

with "div" I assume you mean a div tag in html.
Your grid, I assume is generated with the code behind?

You'll need client-side scripting to do that. Create a function with eg javascript that handles opening and closing the div tag. (test with a simple html button eg)

The difficult part will be to fire an onclick event on the row selection. td tags might support onclicks, but I'm not sure if tr tags do. (if the server-side generated table is using table/tr/td tags in the first place) Again I would test this pure HTML first and work up from there.

So here's what you need to do:
1. create the javascript function to open/close the div tag and test pure HTML
2. Find out what html tags are used by the server-side generated table.
3. Check out in what way you can manipulate those tags (eg. adding properties like style, onclick events, cellpadding, value, ...) If you can't find it, the quick and dirty way would be to wrap the cell's content in div tags and add the onclick in there.
4. Add the onclick event that calls the function generated in step 1.

Here's a very good starting point: javascript reference and tutorial[^]

hope this helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900