Solved

User Control appearance

Posted on 2009-05-04
6
239 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 500 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
c#, case, if 4 37
.Net remove carriage returns, line feeds and tabbs 5 36
.NET Core supports which cell phone platforms? 3 37
VB .net 2010 Byte array 2 22
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

738 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