Javascript If statement not working with onClientSelectedIndexCahnged event

2 posts, 0 answers
  1. des white
    des white avatar
    14 posts
    Member since:
    Sep 2009

    Posted 25 Feb 2010 Link to this post

    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;  
       }  
    }  
     
     
     
  2. des white
    des white avatar
    14 posts
    Member since:
    Sep 2009

    Posted 25 Feb 2010 Link to this post

    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!!
Back to Top