Solved

User Control appearance

Posted on 2009-05-04
6
206 Views
Last Modified: 2013-11-26
I have a menu system set up in a user control.
The system is in a left side div.

What I need to do is the FIRST time the web site is loaded, I need the menu panel to appear as an accordian down after 1 second.

Any ideas?
0
Comment
Question by:lrbrister
  • 3
  • 2
6 Comments
 
LVL 8

Expert Comment

by:ppittle
Comment Utility
In the code behind for your user control, you can use the IsPostBack property to determine if the Control is being loaded for a new request or to a user that is already on your site.  If IsPostBack is false, then the Control is loaded for a new request:

 protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
//Code to 'accordian down' the menu
            }
}
0
 

Author Comment

by:lrbrister
Comment Utility
ppitle
What code will allow the PANEL to accordian down?
0
 
LVL 8

Expert Comment

by:ppittle
Comment Utility
What do you mean by accordian down?  Are you trying to do animation?  Is there an example of this behavior out on the web already that you are trying to emulate?
0
 

Author Comment

by:lrbrister
Comment Utility
ppittle:

I can do an on clink for Panel1.Visible= true/false with the buttin click below
But that is just an "on-off" feature.

I need it to "slide" down/up?



 Protected Sub btnFavorites_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnFavorites.Click
        panelfavorites.Visible = Not panelfavorites.Visible
    End Sub
0
 
LVL 8

Accepted Solution

by:
ppittle earned 500 total points
Comment Utility
lrbrister,

C# does not have any inherient animation controls. Animations on websites are powered by a number of technologies, such as Adobe Flash, Microsoft Silverlight and JavaScript.  Consequently, you will need to use a hybrid approach.

This tutorial provides examples of how to implement sliding animation using JavaScript:
http://www.switchonthecode.com/tutorials/javascript-tutorial-inline-sliding-panels

To incorporate this within your C# application, you'll need to call the JavaScript functions from .NET controls.

For example, to initiate a JavaFunction from a C# button you need to set the OnClientClick property.  If a function requires you to pass in a control ID, you'll need to pass in Control.ClientID:

<script type="text/javascript">
function JavaScriptAnimationFunction (controlToAnimate)
{
//JavaScript code
}
</script>
<asp:Panel ID="MyPanel" runat="server />
<asp:Button ID="RunJavaScriptFunction" runat="server" OnClientClick="JavaScriptAnimationFunction('<%= MyPanel.ClientID %>'

If you need to launch the menu animation only on a page load, you can use Page.ScriptManager to register a javascript method as so:

//Sorry about the C#, I'm a C# developer and don't know the VB syntax off hand.
protected void Page_Load(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "MenuStartScript",
                    "//Code for JavaScript menu animation");
}


Finally, you could always purchase prebuilt controls that do all of this for you, but they can be rather expensive.:  http://www.telerik.com/products/aspnet-ajax/menu.aspx

HTH

PJ
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now