Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 hide panel by java script

Author  Topic 

chiragvm
Yak Posting Veteran

65 Posts

Posted - 2006-10-18 : 02:33:03
hi to all

ihave one problem regarding the panel
in rhis i want to hide the panel with the java script
i writen this much of script

<script type="text/javascript" language="javascript">
function clearmessage()
{
var id = document.getElementById("<%=lblmessage.clientid %>");
id.innerText="";
var id2 = document.getElementById("<%=Panelmsg.clientid %>");
id2.visible = false;

}
</script>


this code is not work
i am not better in java script
please help me

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-10-18 : 04:26:26
for this to work you need to get the div's (what asp:Panel render to in html) id.

a simple document.getElementById("Panelmsg") won't work because
the id of the div is rendered with some extra chars.

you'll need this javascript function:
function findObjWithClientId(Id)
{
var ctrls = document.all;
for(var count = 0; count < ctrls.length ; count ++)
{
var index = ctrls[count].id.indexOf(Id);
if(index != -1)
{
if((ctrls[count].id.length - index) == Id.length)
return ctrls[count];
}
}
return null;
}

// this is how you hide it:
var pnlObject = findObjWithClientId("Panelmsg");
pnlObject.style.visibility='hidden';





Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -