选择ComboBox值时如何加载表单的一部分?

时间:2019-06-24 14:34:54

标签: javascript html asp.net combobox telerik

我想知道是否有人可以提供帮助,但此刻还很困难。我有以下代码:

组合框:

<sq8:ComboBox runat="server" ID="cboRevenueForecasting">
    <Items>
        <sq8:ComboBoxItem runat="server" Value="Flat Phasing" Text="Flat Phasing">
        </sq8:ComboBoxItem>
        <sq8:ComboBoxItem runat="server" Value="Manual Phasing" Text="Manual 
      Phasing"></sq8:ComboBoxItem>
    </Items>
</sq8:ComboBox>

JavaScript:

<script>
    Sys.Application.add_load(FormLoad)

    function FormLoad() {
        HideOpportunity(true);
    }

    function HideOpportunity(sender, eventArgs) {
        var x = document.getElementById("OpportunitySetUp");
        if (x.style.display === "none") {
            x.style.display = "block";
        } else {
            x.style.display =  "none";
        }

        var ForecastingGrid = document.getElementById("ForecastingRevenue");
        ForecastingGrid.style.display = "none";
        var RevenueForecasting  = $sq("[id$='cboRevenueForecasting']").val();

        if (RevenueForecasting == "Manual Phasing") {
            ForecastingGrid.style.display = "block";
        } else {
            ForecastingGrid.style.display = "none";
        }

    }
</script>

在加载表单时,代码起作用,所有内容都被隐藏。当我单击“机会设置”标题时,将显示第一个方框。

然后在“机会设置”中有一个comboBox,如果选择了“手动阶段”值,则应显示第二部分“ ForecastingGrid”。

在选择组合框值之前,这似乎可以正常工作。当将“ autopostback = true”添加到组合框属性时,代码似乎仅执行并显示“ ForcastingRevenue”部分,但这无用,因为它刷新了整个表单,将“ OpportunitySetUp”的其他部分重置为再次隐藏。

是否可以在不添加autopostback属性的情况下加载表单?如果可以的话,我正在使用Cora Sequence框架。

感谢您的帮助!

0 个答案:

没有答案