Div tag to display/ hide a control ....please help

M

~Maheshkumar.R

Hello groups,
i need small code snippet for implementaion of div tag. Let say, if i click
a button, i have to hide a checkbox list. I have placed that control inside
the Div tag, but not responding.

Mahes.




----------------------in codebehind --------------
Button1.Attributes.Add("onclick", "mycall()")

------------------------in aspx. page- -------------

<script language="javascript">
function mycall()
{
alert("responding");
var fr=document.Form1;
fr.green.style.display="none";
alert("yes disabled");
}
</script>
------------
<!--
<DIV id="green" style="DISPLAY: block">
<asp:checkboxlist id="CheckBoxList2" runat="server" Width="173px"
Height="41px" BackColor="Lime">
<asp:ListItem Value="a">a</asp:ListItem>
<asp:ListItem Value="b">b</asp:ListItem>
</asp:checkboxlist>
</DIV>
<asp:button id="Button1" runat="server" Text="Button" Width="121px"
style="Z-INDEX: 101; LEFT: 147px; POSITION: absolute; TOP: 228px">
</asp:button>
-->
 
N

nandha

Hi,
if you use server control it will post back..
please find the code below...

<script language="javascript">
function show()
{
document.getElementById
('hideShow').style.visibility = 'visible'
}
function hide()
{
document.getElementById
('hideShow').style.visibility = 'hidden'
}

</script>


<form id="Form1" method="post" runat="server">
<DIV id="hideShow">
<asp:checkboxlist
id="CheckBoxList2" runat="server" Width="173px"
Height="41px" BackColor="Lime">
<asp:ListItem
Value="a">a</asp:ListItem>
<asp:ListItem
Value="b">b</asp:ListItem>
</asp:checkboxlist>
</DIV>

</form>
<input type=button value="show"
Width="121px" onclick="show()" >
<input type=button value="hide"
Width="121px" onclick="hide()" >

Regards,
nandha.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top