Enabling a panel.

Hello..

I have a Panel control and some controls in it.Panel is disabled at first. When user clicks a Button, I enable the Panel with javascript but the controls in it are not enabled...

What is the reason?and the solution please.

Note:

I do this like that:

<scripttype="text/javascript">

function NewRecord()

{

document.getElementById('Panel3').disabled=false;

}

Thanks in advance.

[867 byte] By [xyzt] at [2007-12-25]
# 1
I'm not sure the getElementById will return the panel object, because ASP.NET will have changed the ID of the panel to something along the lines of _ctl0_panel3.

View the source in the browser, get the actual name of the panel and try the following:document.getElementById(<name>).removeAttribute('disabled');

Rich.

Richard.C.Bower at 2007-8-31 > top of Msdn Tech,.NET Development,JScript for the .NET Framework...
# 2

It's name is Panel 3, if I'm not wrong.

<asp:Panel ID="Panel3" runat="server" Height="459px" Style="z-index: 103; left: 0px;

position: absolute; top: 154px" Width="444px" BackColor="LightGoldenrodYellow">

I tried as you said:

document.getElementById('Panel3').removeAttribute("disabled");

but problem goes on..

Richard.C.Bower wrote:
I'm not sure the getElementById will return the panel object, because ASP.NET will have changed the ID of the panel to something along the lines of _ctl0_panel3.

View the source in the browser, get the actual name of the panel and try the following:document.getElementById(<name>).removeAttribute('disabled');

Rich.

xyzt at 2007-8-31 > top of Msdn Tech,.NET Development,JScript for the .NET Framework...
# 3

The Panel should be rendered to the client so the visible state of the Panel must be true, but the style visibility set to false.

Then provide a variable in the page in the form of javascript like so (there are single quotes in the example) -

Code Behind

ClientScript.RegisterClientScriptBlock(String.Empty.GetType(), System.Guid.NewGuid().ToString(), "var myPanelID = " & panel1.ClientID & ";", True)

Then when the action happens that requires the visiblbiliyt state of the panel to change look for the object myPanel.

client side script

if(document.getElementbyId(myPanelID)){

myPanel.style.display=block; // should initially be none as per a style setting display:none;

}

- sorry, but you may need to reviwe the JS as I have typed it here and casing may be incorrect.

Rgds,

Martin.

mokeefe at 2007-8-31 > top of Msdn Tech,.NET Development,JScript for the .NET Framework...
# 4

I corrected your code and it worked.Thanks. But while I was trying to learn client side programming, I learned some about ATLAS and I saw that its really great.ATLAS in, JS out.

xyzt at 2007-8-31 > top of Msdn Tech,.NET Development,JScript for the .NET Framework...
# 5

You do realise that Atlas is a combination of technologies and is totally dependent on client side javascript?

As such some understanding of those technologies is going to be of use to you in the longer term.

Glad to be of assistance.

Martin.

mokeefe at 2007-8-31 > top of Msdn Tech,.NET Development,JScript for the .NET Framework...

.NET Development

Site Classified