如何从母版页调用timer_tick事件? [英] How to call timer_tick event from master page?

查看:75
本文介绍了如何从母版页调用timer_tick事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个ASP.NET MVC 2 的网站。我有一个主页,它是一个主页。我想使用ajax更新面板,计时器和animationextender以及其他必需的控件在主页上显示一些图像更改效果。我的问题是如何调用计时器刻度事件或模型或控制器的任何功能,以便可以执行图像更改效果。主页主页的代码如下:



I am developing a website in ASP.NET MVC 2. I have a master page which is a Home Page. I want to show some image changing effects on home page using ajax update panel, timer and animationextender and other required controls. My problem is how to call timer tick event or any fuction from model or controler so that image change effect can be executed. code of master home page is as :

<asp:ScriptManager ID="ScriptManager2" runat="server" ViewStateMode="Enabled">
                    
                
 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
 <contenttemplate>
 
Hear are five asp.image controls to show the images///////////////////

                </contenttemplate>
                <triggers>
            <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
        </triggers>
                  
                 
                <asp:Timer ID="Timer1" runat="server" Interval="2000" OnTick="<% hmc.timer_tick_call(Image1, Image2, Image3, Image4, Image5); %>">
                                
                   
                <asp:UpdatePanelAnimationExtender ID="UpdatePanelAnimationExtender1" runat="server" TargetControlID="UpdatePanel1"

                BehaviorID="animation">
                <animations>
                   <onupdating>
                        <sequence>
                            <parallel duration="1" fps="25">
                                <fadeout animationtarget="Image1" duration="1" fps="25" minimumopacity="0" />
                                <fadeout animationtarget="Image2" duration="1" fps="25" minimumopacity="0" />
                                <fadeout animationtarget="Image3" duration="1" fps="25" minimumopacity="0" />
                                <fadeout animationtarget="Image4" duration="1" fps="25" minimumopacity="0" />
                                <fadeout animationtarget="Image5" duration="1" fps="25" minimumopacity="0" />
                            </parallel>
                        </sequence>
                    </onupdating>
                    <onupdated>
                        <sequence>
                            <parallel duration="1" fps="25">
                                <fadein animationtarget="Image1" duration="1" fps="25" minimumopacity="0" />
                                <fadein animationtarget="Image2" duration="1" fps="25" minimumopacity="0" />
                                <fadein animationtarget="Image3" duration="1" fps="25" minimumopacity="0" />
                                <fadein animationtarget="Image4" duration="1" fps="25" minimumopacity="0" />
                                <fadein animationtarget="Image5" duration="1" fps="25" minimumopacity="0" />
                            </parallel>
                        </sequence>
                    </onupdated>
                </animations>









P租借帮助我。





Please help me.

推荐答案

这是一项艰苦的工作。但是我告诉你这个方法论。

你要创建一个接口也将属性声明为Timer。现在你实现这个接口后面的每个页面代码。与下面的签名相同(IMasterTimer是你的界面)

This is a hard work. But i tell to you about this metodology.
You going to create an Interface also declare property as Timer. Now you implement every page code behind class this interface. Same as signature below (IMasterTimer is posit your interface)
Public Default_aspx: System.Web.UI.Page, IMasterTimer



接口在页面文件中创建一个属性作为Timer。您打开母版页并找到加载功能体。转换为页面对象到您的界面。您必须从母版页计时器对象中提供interface属性。同下面


The interface create a property in page file as Timer. You open master page and find load function body. Convert to Page object to your interface. You have to give interface property from master page timer object. Same as below

var imastertimer = (IMasterTimer)Page;
imastertime.Timer = Timer1;



转到页面代码后面的文件。现在在页面加载或其他方法体上触发计时器。


After you go to the page code behind file. Now firing timer on page load or another method body.


这篇关于如何从母版页调用timer_tick事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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