This is a migrated thread and some comments may be shown as answers.

[Solved] Javascript If statement not working with onClientSelectedIndexCahnged event

1 Answer 135 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
des white
Top achievements
Rank 1
des white asked on 25 Feb 2010, 07:16 PM
Hello everyone,

I am trying to write a javscript function that opens a rad window if the user selects a certain value from a rad combo box.
The event fires fine when the user changes a value in the combo box. The problem is that the javascript IF statement seems to be ignored.

 

 

 

 

 

The  radwindow opens even when the selected value is not 4...which I checked with document.write.

Im sure this is a school boy error - but I just cant see what the problem is...

function OnClientSelectedIndexChanged(sender, args)  
{  
   var item = args.get_item();  
   var selectedvalue = item.get_value();  
   //document.write("value is:" + selectedvalue);  
   if (selectedvalue="4")  
   {  
   window.radopen("csat.aspx","UserListDialog1");  
   return false;  
   }  
}  
 
 
 

1 Answer, 1 is accepted

Sort by
0
des white
Top achievements
Rank 1
answered on 25 Feb 2010, 07:22 PM
Typical...as soon as you write out the problem and post it the answer pops into your head!!

I was assigning the variable with = rather than checking for equality with ==

doh!!
Tags
Ajax
Asked by
des white
Top achievements
Rank 1
Answers by
des white
Top achievements
Rank 1
Share this question
or