I am trying to write a messaging system which will allow people to communicate and write messages to each other.
I have a datalist which is populated by an ObjectDataSource. On the ItemDataBound event of the datalist I pick out the data which I want to display and show it in a selection of labels and textboxes .etc... This part of my system works okay.
What I am now trying to do is as follows. We want to allow users to reply to messages and then display them under the message they have replied to. Again, this part of the system works ok, but i now want to add buttons into the replies to allow users to delete .etc... The replies are populated dynamically on the ItemDataBound event, so that we can check whether there are any replies to the each of the messages in the datalist, it has to be done on this event.
After I have dynamically added the buttons in the ItemDataBound event they display on screen fine but when i click the button all of the replies dissapear. I am led to believe that this is because the page is doing a postback and therefore the replies are lost because they are dynamically created. When the button is clicked, I ideally want to call an event in the code behind, using the 'Add Handler' method.
Does anyone have any ideas how I might be able to get this working, or if it seems possible to get it to work?
Many Thanks in Advance.