amit sharma

amit sharma

  • NA
  • 10
  • 10.2k

selectedindexchanged event is not firing in asp.net with opn

Apr 9 2013 1:21 AM
please help me i'm facing a problem with dropdown list i'm using javascript method "onchange" to get dropdown selected value i get the value but dropdown selectedIndexChanged event not firing  please someone help me

my javascript function is that for getting selected value:
 <script type="text/javascript" language="javascript">
        function showAddress_Byamit()
         {
             var e = document.getElementById("TabC_tp1_ddlcountry");
             var country = e.options[e.selectedIndex].text;
          }
</Script>
it works well but the problem in codebehind

<asp:DropDownList 
                ID="ddlcountry" runat="server" AutoPostBack="True" Height="20px" EnableViewState="true"
                OnSelectedIndexChanged="ddlcountry_SelectedIndexChanged" TabIndex="4"  onchange="showAddress_Byamit(); return false"
                Width="100px" ></asp:DropDownList>

here problem is that event "ddlcountry_SelectedIndexChanged" not firing

and in codebehind i add Onchange event as:
  ddlcountry.Attributes.Add("onchange", "showAddress_Byamit(); return false");

Answers (5)