Ajax with ASP.net Gridview and Hidden Div questions

I am coming from a background in coldfusion and trying to re-create a feature in another application using asp.net with C#. Right now I am trying to create a gridview that binds a list of contacts to it, but I want the ability that when you click on a button of some sort, or the row itself, that a hidden div will pop up and the details of that contact will be loaded into the div utilizing ajax. I would also like it to blackout the background so that the div has to be closed before the person can click anything in the background.

I have seen this implemented on many websites and I don't know why I'm having so much trouble accomplishing it. To me, trying to figure out how to put javascript code into a dynamically bound gridview is my biggest challenge. I'm sure If I did this by just writing inline .net code I could accomplish it how I did in coldfusion which was just writing a loop that output each row of the table and created the dynamic link. If anyone has done something similar to this please let me know. The most important thing with the clickable row is that it needs to pass the contactid through the javascript call so that the right contact can be loaded in the detail view div. Thanks for any help you can provide.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Alexandre SimõesManager / Technology SpecialistCommented:
You have the answer in your question... use the templating syntax (inline code as you call it) and do exactly what you want as you said it.

Ah... and don't feel bad about it... :)

The GridView renders an HTML table just like you need everything else is just overhead.
Trying to mix server-side controls with client-side logic is just like signing a long term pain in the butt contract. You'll find yourself hacking with ScriptManager to inject javascript from the server and probably hacking ajax with update panels...
You'll have problems with the controls ID and you need to inspect what on earth the server-side control renders so that you can hijack it properly.

From my experience I tell you: Just don't do it.

If you don't want to do the in-line loop, request the data with an AJAX call or serialize it to json and do you're loop in javascript.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.