Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3550
How to get current value
posted

I need to get the current value of the WebDropDown.

I wrote the following code.

I get exception in get_currentValue: "object does not support this property or method"

 

 
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind=" WebForm1.aspx.cs " Inherits="WebApplication43.WebForm1" %>


<%@ Register Assembly="Infragistics4.Web.v11.2, Version=11.2.20112.2159, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.Web.UI.ListControls" TagPrefix="ig" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<html xmlns=" http://www.w3.org/1999/xhtml ">
<head runat="server">
    <title></title>
</head>
 
 <script language="javascript" type="text/javascript">
     function myFunction() {
         var combo = document.getElementById("WebDropDown1");  //$("#WebDropDown1");      
         var value = combo.get_currentValue();
     }
</script>

<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
       <ig:WebDropDown ID="WebDropDown1" runat="server" Width="200px" CurrentValue="1">
        <Items>
            <ig:DropDownItem Selected="False" Text="1" Value="">
            </ig:DropDownItem>
        </Items>
    </ig:WebDropDown>
    <button onclick="myFunction()">Click me</button>
    </div>
 
    </form>
   
</body>
</html>

גלעד ספטי

  • 15979
    Suggested Answer
    posted

    Hello drpoalim,

    You should use “$find(“<your dropdown ID>”);” function to get reference to “WebDropDown” on Client-Side:

    var combo = $find(“WebDropDown1”);

    Then you can use get_currentValue() function.