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
Javascript activates server functions
posted

on a dropdown -comboCurrencies,  I attach to client event SelectionChanged.

on  javascript I change items of another dropdown -comboPremium.

The user chooses another item on comboCurrencies.

 on debugging, after the javascript fires, I notice that I reach to the Page_load.

I dont want the JS. to cause me to get to the server function.

Why does this happen?

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;

using Infragistics.Web.UI.EditorControls;
using Infragistics.Web.UI.GridControls;


namespace OptionPricer
{
    public partial class Pricer : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
        }    
    }
}

 

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Infragistics4.Web.v12.2, Version=12.2.20122.2054, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.Web.UI.EditorControls" TagPrefix="ig" %>
<%@ Register Assembly="Infragistics4.Web.v12.2, Version=12.2.20122.2054, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.Web.UI.ListControls" TagPrefix="ig" %>
<%@ Register Assembly="Infragistics4.Web.v12.2, Version=12.2.20122.2054, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.Web.UI" TagPrefix="ig1" %>
<%@ Register Assembly="Infragistics4.Web.v12.2, Version=12.2.20122.2054, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.Web.UI.GridControls" TagPrefix="ig" %>
<%@ Register Assembly="Infragistics4.Web.v12.2, Version=12.2.20122.2054, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.Web.UI.LayoutControls" TagPrefix="ig" %>
<html xmlns="http://www.w3.org/1999/xhtml">

<head id="Head1" runat="server">
<title></title>
    <script type="text/javascript">
        function ComboCurrenciesChanged() {
            var comboPrem = $find("comboPremium");
            comboPrem._elements["List"].innerHtml = '';
            comboPrem.loadItems('ILS', false);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <ig1:WebScriptManager ID="WebScriptManager1" runat="server">
    </ig1:WebScriptManager>
    <ig:WebDropDown ID="comboCurrencies" ClientIDMode="Static" runat="server">
        <ClientEvents SelectionChanged="ComboCurrenciesChanged" />
        <Items>
            <ig:DropDownItem Key="USD-ILS" Selected="False" Text="USD-ILS" Value="USD-ILS">
            </ig:DropDownItem>
            <ig:DropDownItem Key="EUR-USD" Selected="False" Text="EUR-USD" Value="EUR-USD">
            </ig:DropDownItem>
        </Items>
    </ig:WebDropDown>
    <ig:WebDropDown ID="comboPremium" runat="server" ClientIDMode="Static">
    </ig:WebDropDown>
    </form>
</body>
</html>

Parents
No Data
Reply Children