Click here to Skip to main content
15,904,346 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have an checkbox with check changed event. Whenever i change the chech it fires the check_changed event.

After that if i reload the page, its automatically calls the check_changed event.

I want to know how to get rid of this check_change event in page_load.

If needed, i will explain again.

Thanks in Advance.
Posted
Comments
Pradeep_kaushik 13-Sep-12 7:22am    
i am not sure but you can try the event between
if(!ispostback)
{
---- your code
} on page load
akee seth 13-Sep-12 7:25am    
but after check change if i refresh it will automatically call the check_change event.
That is my issue.
But i can not under stand what you are trying to say?
So please explain

Hi ,
Check this
C#
protected void Page_Load(object sender, EventArgs e)
{
     CheckBox1.CheckedChanged -=new EventHandler(CheckBox1_CheckedChanged);
}


Best Regards
M.Mitwalli
 
Share this answer
 
Add this method

C#
public  RestartPage()
    {
    Response.Redirect(Request.Url.PathAndQuery)
}

call it after checkbox event or any event u want.

follow this link for more info
http://forums.asp.net/p/1842974/5143995.aspx/1?Re+remove+check_change+event+in+page_load[^]
 
Share this answer
 
Hi,

What do you mean by refresh ? if you press "F5" or clicked Reload after the check_changed event been fired, then "F5" will make the operation requested by immediate prevoius post back. That is why, the event is firing again since that was immediate previous HttpRequest.

hope it helps.
 
Share this answer
 
Comments
akee seth 13-Sep-12 7:30am    
Both F5 and reload causing the same problem.But i want to know is there any way to get rid of that.
Karthik Harve 13-Sep-12 7:35am    
if you press F5, one confirmation message will come. if you click "Retry" then the action will be processed, if you click "Cancel" nothing will be happended, just page will be reloaded.
akee seth 13-Sep-12 7:38am    
sorry, but no confirmation message is displayed while pressing f5.
Karthik Harve 13-Sep-12 7:41am    
which browser are you using ?
akee seth 13-Sep-12 8:23am    
firefox, googlechrome

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900