views:

43

answers:

1

I spent the whole of last night searching for a free AspNet web chat control that I could simply drag into my website. Well the search was in vain as I could not find a control that matched my needs i.e List of users, 1 to 1 chat, Ability to kick out users..

In the end I decided to create my own control from scractch. Although it works well on my machine Im concerned that It maybe a little crude and unpractical on a shared hosting enviroment.

Basically this is what I did :

  1. Created an sql database that stores the chat messages.
  2. Wrote the stored procedures and and included a statement that clears old messages

Then the 'crude' part :

  1. Dragged an update panel and timer control on my page
  2. Dragged a Repeater databound to the chat messages table inside the update panel
  3. Dragged another update panel and inside it put a textbox and a button
  4. Configured the timer control to tick every 5 seconds.

..and then I made it all work like this In the timer tick event I 'refreshed' the messages display by invoking Databind() on my repeater i.e

 protected void Timer1_Tick(object sender, EventArgs e)
    {
       MyRepeater.DataBind();
    }

Then in my send button click event

 protected void btnSend_Click(object sender, EventArgs e)
    {

       MyDataLayer.InsertMessage(Message, Sender, CurrTime);

    } 

Well It works well on my machine and Ive got the other functionalities(users list, kick out user..) to work by simply creating more tables.

But like I said it seems a little crude to me. so I need a proffesional opinion. Should I run with this or try another Approach ?

+1  A: 

I'm not sure why you think it is crude - I would expect any other ASP.NET chat control to be developed in exactly the same fashion using client-side polling. As an alternative to using Update panels however, I would recommend writing the client-side AJAX functionality using JQuery (or some other Javascript framework) - the ASP.NET Update panel is really just a standard ASP.NET postback using a rendering trick so the screen doesn't have to be refreshed.

In regards to running with what you've got, if you've gone as far as you have already, I would continue on. It will be a great learning exercise on the requirements for your chat client even if you decide to replace it with something else down the track.

Bermo
I agree, I don't think there's any major issues with this. Remember, get somethign working right 1st then later you can take your time to craft it into a masterpiece
TJB
Well I did some research before creating my control and since I dint find one using my combination of a repeater and update panel figured I was taking the wrong route.
The_AlienCoder