Hide Div

  • Thread starter Thread starter Miguel Dias Moura
  • Start date Start date
M

Miguel Dias Moura

Hi,

I am trying to make a <div> invisible when I call page.aspx.

When I call page.aspx?type=1 the <div> should be visible.

I have this line:
<div runat="server" visible='<%# Request.QueryString("type") <> ""
%>'"></div>

I get this error: "The server tag is not well formed"

Why I get this?

Thanks,
Miguel
 
Miguel,
You can't do that. Set it to visible='false' in the div, give the div a
name such as div1, then add some VB or C# code that makes the change.
In VB:

if request.querystring("type") <> "" then div1.visible = "true"
Hope that helps,
Jason
 
I think you have an extra " right before ></div>

Also, I think you are going to want your expression to return True or False.
 
Yes, I notice that just now. Thanks.
But it's still not working. I believe I need to set it as true or false.
How should I do it?

However I get many answers like the one of Jason.
Is there a problem in doing it this way?

Thanks,
Miguel
 
No, I think it's fine. Basically, your expression should return the string
True or False.

If you do it his way, then set the Visible property to False or True, not to
the string. That property is a boolean not a string.
 
Hello.
My apologies. It appears that your code (with the changes indicated in
other posts) should work. My code may be more familiar to people, but
your technique shoudl work too. :)
Jason
 
Back
Top