Monday, March 26, 2012

perhaps a simple question

Hi,

i have a problem.

I have a textbox and a button and a link in my application. When the user clicks the button, the text of the textbox is inserted in my table northwind.
After this is done succesful i want to display a messagebox. After searching in the groups i did this.

Button1_Click(......)
{
--entry in northwind--

string alertscript= "<script language= JavaScript>alert('Succefull inserted');</script>";
if(!IsClientScriptBlockRegistered("alert"))
{
this.RegisterClientScriptBlock("alert", alertscript);
}
}

It works good. But when i click now on the link to another page and then after that click the backbutton in the IE6 to my first page, then the messageBox pops up again. I don`t know why this is done. Is the script still registered ? Please help me? I need to stop this.

Thankswhen you hit your back button, your going back to a cached copy of the page which still has the script in it.

personally, i wouldnt use an alert. Id put a Label/Literal control on the page and then upon successfully inserting a db record, you can set the Text of that control and make it visible.

When the user hits their back button, they still see the old message, but it's not in the way...

0 comments:

Post a Comment