I’m going to implement an email-like page in my asp.net web project (VS2010,C#), I want my messages to be viewable when users clicks message row (something like yahoo or gmail), at the moment I’ve inserted a hyperlink (subject field) in one of the cells of the message row, this hyperlink displays the message, but I want my users to be able to display message by click on the row, just like yahoo mail or gmail, how is it possible? I know to how to change selected row color using javascript in client side, I’m passing a query string to page which says which message to display, so I’m going to work in server-side (codebehind), is it possible? how can it be done?
thanks
You’ll need to think about design before implementing a solution.
Pure Serverside
click on a control, resubmit the page and the control’s eventhandler executes code to display the message. This is the simplest way.
Serverside + JavaScript
load all the message content but hide it with JS/JQuery. a click on a message link executes clientside code to reveal the whole message. This is bandwith heavy.
AJAX
display message headers on load. a click execute JS/JQuery code to load the message via an XMLHttpRequest. This is the most modern and slickest way but requires a bit of plumbing. You’d need to implement a webservice, HttpHandler or PageMethod from which you would request the message data. And read up on AJaX.
I’ll probably get downvoted for mentioning JQuery at all, but regardless i’d sugget you take a look at its AJaX capabilities if you want to get something up and running quickly. it hides a lot of JS behind simple method interfaces and i’d always recommend people take the time to go deep into JavaScript (its a very powerful technology) but there’s. no harm in the odd (industry-standard) shortcut imho.
hth.