View Single Post
  #4 (permalink)  
Old August 2nd, 2007, 07:04 AM
gaurav_jain2403 gaurav_jain2403 is offline
Friend of Wrox
 
Join Date: Feb 2006
Location: noida, UP, India.
Posts: 133
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to gaurav_jain2403
Default

It is running your code twice on clicking Ok, because you have explicitly mentioned Form1.submit() in your code of adding the attribute. Also, it returns true, which again calls the server SelectedIndexChanged event. On Cancel, it cancels your last event, means it cancels the drop down list selection so it displays the last selected value, not the current value. For first problem, i.e. on clicking of Ok, write the code as follow:

cbDayType.Attributes.Add("onchange", "if (confirm('Do Are you sure you want to update Date?')) return true; else return false;")
Reply With Quote