如何在更新面板< trigger>中调用/触发javascript函数标签 [英] How to call/trigger javascript function inside the update panel <trigger> tag

查看:57
本文介绍了如何在更新面板< trigger>中调用/触发javascript函数标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个下拉列表框.我正在将服务器中的值加载到该列表框中,并且这些值正在正确加载.

I have an dropdown list box. I am loading the values from server to that list box, and the values are loading correctly.

我正在使用<trigger>事件来触发C#函数以显示元素.

I am using an <trigger> event to trigger the C# function to display the elements.

现在我想用javascript做到这一点.我该怎么做.

Now I want to do this in javascript. How to I do that.

我的控件位于updatepanel内部.我的代码是:

My control is located inside the updatepanel. My code is:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
       <asp:DropDownList ID="list1" runat="server" Height="20px" Width="250px"
           OnSelectedIndexChanged="list1_SelectedIndexChanged" >
             <asp:ListItem>--Select--</asp:ListItem>
        </asp:DropDownList>
    </ContentTemplate>
    <Triggers>
       <asp:AsyncPostBackTrigger ControlID="list1" Name="SelectedIndexChanged"/>
    <Triggers>
</asp:UpdatePanel>

现在,我想在该触发事件中调用Javascript函数.我该怎么做,甚至有可能做?

Now I want to call the Javascript function inside that trigger event. How do I do it, and is it even possible to do?

推荐答案

如果要在下拉列表的change事件上调用函数,则可以使用jquery的change()事件.同样,在调用javascript函数时,无需使用更新面板.

If you want to call a function on the change event of the drop down then you can use the change() event of jquery. Also while calling javascript functions there is no need to use the update pannel.

这篇关于如何在更新面板&lt; trigger&gt;中调用/触发javascript函数标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆