473,811 Members | 3,811 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Boolean Visible Property problem

Hi

I'm new to asp.net and c# and I've got stuck on an apparently simple
problem:

I'm trying to make a HyperLink dynamically visible/invisible.

This is the HTML:

<asp:HyperLin k Runat="server" Text="Back"
NavigateUrl='He adingList.aspx' Visible='<%=isN otTop()%>' />

This is the in the .cs file:
public string isNotTop()
{
return ("false");
}
I get the error message:
<%=isNotTop() %> is not a valid value for Boolean.

I've tried getting isNotTop() to return a boolean but it doesn't help.

I've done something similar within a DataList using <%#...%> and it's
worked OK.

Can someone guide me in the right direction here?
Cheers
John South
Pangbourne UK
Nov 16 '05 #1
2 8109
Hi John,

Yes it would be much better to bind the Visible property to your function by
using the
<%#...%> construct:

<asp:HyperLin k Runat="server" Text="Back"
NavigateUrl='He adingList.aspx' Visible='<%# isNotTop()%>' />

and make sure isNotTop() returns a Boolean value.

You will have to call DataBind() on that control though
to make it work.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"John South" <js****@cix.co. uk> wrote in message
news:d2******** *************** ***@posting.goo gle.com...
Hi

I'm new to asp.net and c# and I've got stuck on an apparently simple
problem:

I'm trying to make a HyperLink dynamically visible/invisible.

This is the HTML:

<asp:HyperLin k Runat="server" Text="Back"
NavigateUrl='He adingList.aspx' Visible='<%=isN otTop()%>' />

This is the in the .cs file:
public string isNotTop()
{
return ("false");
}
I get the error message:
<%=isNotTop() %> is not a valid value for Boolean.

I've tried getting isNotTop() to return a boolean but it doesn't help.

I've done something similar within a DataList using <%#...%> and it's
worked OK.

Can someone guide me in the right direction here?
Cheers
John South
Pangbourne UK


Nov 16 '05 #2
HI John

You are mixing the old ASP model with the new one :)

You have two options, you can set it in the code simply using an assignment
like
theHyperLink.Vi sible = false;
you can do this from anywhere in the code behind.

You can use the DataBind mechanist, for this you have to change the <%= %>
tag for <%# %>
Please make note that it's a complete new feature !!
if so you have to change the type of the function to the correct type of
the Visible property:
public bool isNotTop()
{
return false;
}
Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"John South" <js****@cix.co. uk> wrote in message
news:d2******** *************** ***@posting.goo gle.com...
Hi

I'm new to asp.net and c# and I've got stuck on an apparently simple
problem:

I'm trying to make a HyperLink dynamically visible/invisible.

This is the HTML:

<asp:HyperLin k Runat="server" Text="Back"
NavigateUrl='He adingList.aspx' Visible='<%=isN otTop()%>' />

This is the in the .cs file:
public string isNotTop()
{
return ("false");
}
I get the error message:
<%=isNotTop() %> is not a valid value for Boolean.

I've tried getting isNotTop() to return a boolean but it doesn't help.

I've done something similar within a DataList using <%#...%> and it's
worked OK.

Can someone guide me in the right direction here?
Cheers
John South
Pangbourne UK

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2416
by: mike | last post by:
Hi, I'd like advice from a .NETer. I have a loadcombo routine which sets the selectedindex to -1 if it's an "add record", but then it goes to a security routine which, based on permissions sets the visible property. When the visible property is set.. 'Petition Type lblPetitionType.Visible = False
5
1654
by: Lucvdv | last post by:
Can anyone explain why this happens with the code at the bottom? It looked like a thread safety issue, but changing the declaration of Label1 to Shared doesn't help. Standard windows form; one label, two buttons. - if Label1.Visible is set to True in the form designer, everything works as expected. Button1 toggles the label visibility, and Button2
6
9211
by: Marc Robitaille | last post by:
Hello, Hello, I developed a UserControl. It has funny behavior. It is composed of three controls. A texbox, a combobox and a button. There are three properties to indicate the visibility of the three controls. The only property which functions well is the one for the button. The two others, even if I do: UserControl.TextboxVisible = True or UserControl.ComboboxVisible = True, the textbox or the combobox remain invisible. I placed a...
6
5129
by: Robert | last post by:
Quick question about the visible property on a form control. I have a label that displays a message if a certain criteria is met. By default the label is visible. I want access to compare a calculated field on a tab page with a control on the main part of the form: If Me.CalculatedControl = Me.MainFormControl Then Me.MessageLabel.Visible = False End If I can't figure out where to put this to make it fire. Do I need to reference the tab...
2
18893
by: Keithb | last post by:
I need to hide a GridView's "edit" column if the user's role does not support editing. However, the column's Visible property does not support databinding. Is there a workaround? Thanks, Keith
0
2441
by: landesjoe | last post by:
Hi, here's my problem in short: Text boxes in gridview don't seem to hold their value if the column's .Visible property is changed back and forth. I've got a form with a gridview populated from a data view (which in turn is loaded from a manually setup DataTable for testing purposes). One of the columns in the grid is a checkbox that's tied to an event handler that'll change the .Visible property of a column with a text box. That text...
8
4017
by: Doc John | last post by:
I have an MDI container with a child Form which will be visible according to certain events. The problem is that when I set the property Visible to False and then back to True, the Form will be in another location, or it will be maximized. Why does the child Form change its location when the Visible propery is set true (after being set to False)? Why doesn't it stay with the same Size and the same Location? Thanks.
5
3950
by: =?Utf-8?B?VGVycnk=?= | last post by:
Hi, I have a couple of labels on a form and their visible property is bound to boolean properties on a custom object. When I first load the form, all works as it should. This form is 'tied' together with a search form, and the user can go back and forth. When the user hits ok, the form is hidden and the search form is shown and visa-versa. The problem is that when the form is hidden when the labels visible property is False, and then...
6
2653
by: MLH | last post by:
I have a small bitmap graphic on a report. I would like to set it's Visible property to True whe the value of a certain field on the report is True. Can I do that? I have tried in the OnFormat event code... Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) If Me!ThreeBucks = True Then Me!ThreeDollarRansomNote.Visible = True Else Me!ThreeDollarRansomNote.Visible = False
0
9604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10644
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10127
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9201
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7665
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.