+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Acknowledgement Message

Acknowledgement Message

2 posts, 0 answered
  1. Pik Lee
    Pik Lee avatar
    142 posts
    Registered:
    13 Aug 2012
    19 Mar 2010
    Link to this post
    I would like to publish a message with a submit button, after the user read the message, he/she can click on the submit button as an acknowledgement. Then the database can capture who has read the particular message. The next time the user login, he/she would not see that particur message since he/she already read the message,

    Can this be done in Sitefinity? how?

    Thanks,
    Pik
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    19 Mar 2010
    Link to this post
    Hi Pik Lee,

    You have to create a custom table in the database. The table could have four columns - number -auto increment, username ( if the user is authenticated), IP - address, flag - 1 or 0 (true or false).

    If the user clicks on the button make a new record in this table and populate it with data. Then on the same page you should have a control that checks whether the current user /ip has a flag in the database table.

    To get the IP you can use Context.Request.ServerVariables ["REMOTE_ADDR"]. You can check whether the IP exists in the database using SQL-LINQ queries

    sample

    string IpAddress =  Context.Request.ServerVariables ["REMOTE_ADDR"]
    Guid ip = new Guid(IpAddress);
     
     var query = (from sub in dataContext.FormVisitors
                             where sub.IP == ip
                             select sub.UserName).SingleOrDefault();
                if (query != null)
                {
                    MyForm.Visible = false;            
                }
                else
                {
                    MyForm.Visible = true;
                }
     

    All the best,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
2 posts, 0 answered