0

i have to Hide/Unhide panel of asp web form by javascript. pls Help

for (var l = 1; l <= ddlSizesValue; l++) 
  {
        var Size = "pnlProduct1Design1Color1Size" + l;
        var pnl = document.getElementById('pnlProduct')
       var pnlSize = document.getElementById(Size);
        pnlSize.style.display = 'block';            
   }

before javascript i was using

System.Web.UI.HtmlControls.HtmlControl pnlSize = (System.Web.UI.HtmlControls.HtmlControl)pnlProduct.FindControl(Size);

in c# to find control and it was working fine. but to avoid page load i am using javascripting.

thanks in advance

Ole V.V.
  • 81,772
  • 15
  • 137
  • 161
Umair
  • 31
  • 6

2 Answers2

0

To hide an element in Javascript you would normally do something like this:

document.getElementById("pnlProduct").style.display = "none";
MandyShaw
  • 1,088
  • 3
  • 14
  • 22
  • 1
    pnlProduct is the ID of the panel. In var Size i have inserted ID of another Panel which i want to show/Hide Which is inside 'pnlProduct ' – Umair Feb 27 '19 at 18:50
0

i have done it by changing variable size to:

  var Size = "ctl00_ContentPlaceHolder1_ucSetProduct1Detail_pnlProduct1Design1Color1Size" + l;

now its working fine.

Umair
  • 31
  • 6