如何在javascript中编写radcombobox selectedindexchange事件?

时间:2015-10-10 05:30:10

标签: javascript asp.net vb.net

我不知道如何在radcombobox selectedIndexchange中编写javascript函数。

ASP.NET

<tr>
<td>
<asp:Label runat="server" ID="label73" CssClass="labels" Text="Call Response"></asp:Label>
</td>
<td>
<telerik:RadComboBox runat="server" Skin="Metro" ID="cbocallresponse" AutoPostBack="true" EmptyMessage="Select Call Response" ZIndex="100001">
<Items>
                                                            <telerik:RadComboBoxItem Value="Attended" Text="Attended" />
                                                            <telerik:RadComboBoxItem Value="NoAnswer" Text="NoAnswer" />
                                                            <telerik:RadComboBoxItem Value="CallBacklater" Text="CallBacklater" />
                                                            <telerik:RadComboBoxItem Value="Number does not exists" Text="Number does not exists" />
                                                            <telerik:RadComboBoxItem Value="Wrong Number" Text="Wrong Number" />
</Items>
</telerik:RadComboBox>
 <span class="warning">*</span>
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" CssClass="warning" Text="Select call response" ControlToValidate="cbocallresponse" ValidationGroup="CallValidate"></asp:RequiredFieldValidator>
</td>
</tr>

Vb.Net

Private Sub cbocallresponse_SelectedIndexChanged(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles cbocallresponse.SelectedIndexChanged
        If cbocallresponse.SelectedValue = "CallBacklater" Then
            pnlSchedule.Visible = True
            popwindow(radcalllog)
        Else
            popwindow(radcalllog)
        End If
    End Sub

我想写下这个selectedindexchange的javascript函数,因为我得到每个selectedindex得到的回发。

1 个答案:

答案 0 :(得分:0)

我不确定popupwindow在这里我的解决方案是

  <telerik:RadComboBox runat="server" OnClientSelectedIndexChanged="cl_Indexchange" Skin="Metro" ID="cbocallresponse" AutoPostBack="true"
                                                        EmptyMessage="Select Call Response" ZIndex="100001">
                                                        <Items>
                                                            <telerik:RadComboBoxItem Value="Attended" Text="Attended" />
                                                            <telerik:RadComboBoxItem Value="NoAnswer" Text="NoAnswer" />
                                                            <telerik:RadComboBoxItem Value="CallBacklater" Text="CallBacklater" />
                                                            <telerik:RadComboBoxItem Value="Number does not exists" Text="Number does not exists" />
                                                            <telerik:RadComboBoxItem Value="Wrong Number" Text="Wrong Number" />
                                                        </Items>
                                                    </telerik:RadComboBox>

进入<script>代码

  <script language="javascript" type="text/javascript">
        function cl_Indexchange(sender, eventArgs) {
            var pnl = document.getElementbyid("pnlSchedule");
            var item = eventArgs.get_item();
            if ( item.get_text() == "CallBacklater")

                 pnl.style.display="none";

               else
                 //if you what to make it visible
                  //pnl.style.display="block";
                  ....

        }
    </script>

希望这会有所帮助