how to show a textbox(visible=true) based on dropdownlist selection using client scri

arun_mrk

Well-known member
Joined
Apr 1, 2003
Messages
51
Location
beijing
Initially when the page is load i had set a textbox property to visible false

C#:
txtGrpName.Visible=false;
If user change the default item in a dropdownlist(ddlGrpName) then i have to show the textbox

so i have written client side script

C#:
<script language="javascript">
function CheckGroup()
{
  if (Register.ddlGrpName.value==-1)
  {
    Register.txtGrpName.style.visibility=visible;
  } 
  else
  {
				
    Register.txtGrpName.style.visibility=hidden;
  }
}
</script>
and in code behind
i have added
C#:
ddlGrpName.Attributes.Add("onchange","CheckGroup();");

but his code doesnt work because txtGrpName is not visible at the time of display so i couldnt again
reset to visible =true in client script.

How to do it done?


[edit]Please use
C#:
 tags [/ cs] or [code=vb] tags [/ vb] , <code> tags </code> do not work[/edit][/COLOR]
 
Last edited by a moderator:
Back
Top