By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,812 Members | 856 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,812 IT Pros & Developers. It's quick & easy.

Refresh problem

P: n/a
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
*-----------------------*
Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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

"sandhya.net" <ha**********@rediffmail-dot-com.no-spam.invalid> wrote in
message news:41**********@Usenet.com...
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
*-----------------------*

Nov 19 '05 #2

P: n/a
Can you explain me in detail.

Thanks
Sandhya.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 19 '05 #3

P: n/a
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

"sandhya.net" wrote:
Can you explain me in detail.

Thanks
Sandhya.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*

Nov 19 '05 #4

P: n/a
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
"sandhya.net" wrote:
Can you explain me in detail.

Thanks
Sandhya.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*

Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.