Refresh problem

  • Thread starter Thread starter sandhya.net
  • Start date Start date
S

sandhya.net

Hi,

I have a dropdown which displays the Products and Add button on my
Asp.net web page. When the user selects a product from the dropdown
and
Clicks the add button it adds the selected product to the datagrid.

The problem is when the user adds the product and clicks the refresh
button on the browser,the same item is added to the datagrid once
again. How to prevent calling Add_click Event when the refresh is
clicked on the web page.

Any help, greatly appreciated.

Thanks in advance,
Sandhya.net

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
 
It's a known problem of refresh button behavior. It always repeat the last
postback exactly as it was. You can't change it. You can fight it only on
server side by supplying a sort of unique identification for each Add
operation. If another Add postback comes with the same id, it must be
because of refresh and you can ignore it.

Eliyahu
 
Hi,

After clicking the "Add" button, a postback occurs, and it executes the code
on the server side, in your case, it adds the product to datagrid, and sent
to the client browser. When the client clicks the refresh button on his
browser, the same thing occurs again. Add the product is added once more. You
can't do anything with that. You can instruct the client, not to click the
"Refresh" button.

R U from India? Me too.

Prakash.C
 
Hi,

After clicking the "Add" button, a postback occurs, and it executes the code
on the server side, in your case, it adds the product to datagrid, and sent
to the client browser. When the client clicks the refresh button on his
browser, the same thing occurs again. Add the product is added once more. You
can't do anything with that. You can instruct the client, not to click the
"Refresh" button.

R U from India? Me too.

Prakash.C
 
Back
Top