Click here to Skip to main content
15,921,841 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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.NET
<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>




Please help me.
Posted
Updated 27-Aug-16 11:33am
v5
Comments
F-ES Sitecore 26-Aug-16 9:46am    
You're not using mvc, this question makes little sense.

1 solution

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)
C#
Public Default_aspx: System.Web.UI.Page, IMasterTimer

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
C#
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.
 
Share this answer
 
Comments
K N Sharma 30-Aug-16 5:47am    
Dear Halityurttas,
Thanks for the reply.

But, your are telling to use code behind code. will this not violate the MVC concept.
Halit Yurttaş 30-Aug-16 8:16am    
But you dont use MVC like view. The asp.net webforms parts develop to "event based" standarts. Also my code sample so. Otherwise you use wrong way

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900