Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

User Control appearance

Posted on 2009-05-04
6
Medium Priority
?
246 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 8

Expert Comment

by:ppittle
ID: 24296261
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
ID: 24315556
ppitle
What code will allow the PANEL to accordian down?
0
 
LVL 8

Expert Comment

by:ppittle
ID: 24315607
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
ID: 24315683
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 2000 total points
ID: 24355146
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

705 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