Click here to Skip to main content
12,250,675 members (38,236 online)
Rate this:
Please Sign up or sign in to vote.
Hi to all,
I am Using Javascript Function for Hiding and showing a panel when user clicks a hyperlink..its working fine, but in postback event all panels automatically visible..
how to

My Javascript Function :

function ShowHide(id) 
		var e = document.getElementById(id);
		if( == 'block' ||'') = 'none';
		else = 'block';
		alert( "Error in JS Function: 1" + e); 

My PageLoad event :

If Not IsPostBack Then
 End If
Private Sub AddAttributes()
          Hplink.Attributes("onclick") = "ShowHide('Panel1');"
          Hplink.Attributes("onclick") = "ShowHide('Panel2');"
          Hplink.Attributes("onclick") = "ShowHide('Panel3');"
          Hplink.Attributes("onmouseover") = "'pointer'"
          Hplink.Attributes("onmouseout") = "'pointer'"
        Catch ex As Exception
        End Try
    End Sub
pls..give code for it..
Posted 25-Dec-11 18:01pm
Edited 25-Dec-11 18:08pm
Karthik Harve 26-Dec-11 0:04am
[Edit] pre tags added.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Call javascript function showhide() after each successful event occured using

ScriptManager.RegisterStartupScript(this,this.GetType(), "%#######%", "ShowHide('Panel1');",true);


this.ClientScript.RegisterStartupScript(this.GetType(), "%#######%", "ShowHide('Panel1');",true);

"ShowHide('Panel1');" it depends on you what you want to display. if any clarification then tell me.
VenuKalyan 27-Dec-11 0:13am
it does't work..iam using vs2003 with

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 26 Dec 2011
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100