I am adding an stackoverflow-esq type of notification bar to my site.
On the server side I am adding divs for display:
for (int i = 0; i < dt.Rows.Count; i++ )
{
string script = "<div class='hover-notification' style='display:none;'>";
script += dt.Rows[i]["messageText"].ToString();
if ((bool)dt.Rows[i]["canDismiss"] == false)
script += "<span class='dismiss'><a title='Dismiss notification'>x</a></span>";
script += "</div>";
ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript" + i, script);
}
The client side code is:
$(document).ready(function () {
$('.hover-notification').prependTo('body').slideDown('slow');
$('.dismiss').click(function () { $(this).parent().slideUp('slow').remove(); });
});
I have a table which holds all of the messages for all users and has a messageID primary key. Messages are added to the table on some events, and messages which are not dismiss-able are removed in other events.
What I want to do is mark the message as dismissed once the user clicks the dismiss button.
I’m not sure how to do this.
Could someone please point me in the right direction?
p.s. I’m also open to any comments on the server-side/client-side code I have so far.
If I understand your needs, you want to approve dismiss on server side.
Try :
What you have to do is create this dismiss.asp receiving an id freshly pushed on the :
Am I responding to your question ?