Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding a Layer using VB.NET

Status
Not open for further replies.

digriz60

Programmer
Aug 15, 2002
15
US
Every example of hiding/showing a layer on google is using Javascript. This would be cool, but I am writing most of my stuff in VB.NET and can't call a client side script from the server side. Basically I have four check boxes that a user would check one or many to unhide text boxes so they could input search criteria. That works. But I want a routine to hide the text boxes if they UNCHECK the checkbox. The layer hiding is done in Javascript, so I can't make a simple VB sub to check if chkbox1.checked it simply won't call the java function...Therefore, is there an easy way in VB to hide or unhide a layer? I'm sure there is, I'm just a dunce.

Thanks,

Steve
 
Not sure if this is what you want to do? In .NET all web controls have a property called 'visible'. It determines wether the control is rendered as HTML to the response stream or not. You could use this to hide the checkboxes as such if it suited your application...

Alternatively you can fire a client side script from the server by using the Page.RegisterClientScriptBlock method....


Rob

Go placidly amidst the noise and haste, and remember what peace there may be in silence - Erhmann 1927
 
Thanks! Based on your response, I was able to make the textboxes visible and invisible, since they are web controls. A secondary issue I had was making layers visible or not, since they are not web controls. I want to have a "Success" banner or messagebox flash upon update, but I'm having a hell of a time. I tried the RegisterClientScriptBlock, but maybe I'm calling the function wrong..it doesn't occur at an event like OnClick, just when the SQL update is done, I want to call Success()

This:
try
connection.open()
dim da as SqlCommand = New SqlCommand(stringme, connection)
da.ExecuteNonQuery()

catch ex as SqlException
response.write(ex)
response.write(stringme)
Success()
finally
connection.close()
end try

compiles incorrectly, saying Success() isn't a registered name, but I declared the block in the Page_load sub..am I calling it wrong? Is there an easy way to hide or unhide a DIV? in VB?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top