473,468 Members | 1,314 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

simple binding properties on the page - simple but impossible

Simple problem - binding Visible property of label to Checked
property of radiobutton on the same form.
How do I do that in VS2005??
Visible="<%# radiob.Checked %>" - DOESN'T WORK
It was so simple in 2003 but how it can be done in VS05
using binding expressions. Theres no controls listing under 'Expressions'
on the designer properties window.
Please help.

Eric
Dec 7 '06 #1
2 1624
Eric,

How about something like this:

in your Page.aspx:
<head runat="server">
<title>Untitled Page</title>
<script language=javascript>
function toggleLabel() {
with (document) {
if (getElementById('CheckBox1').checked) {
getElementById('Label1').style.visibility='visible ';
}else{
getElementById('Label1').style.visibility='hidden' ;
}
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:CheckBox ID="CheckBox1" runat="server" onClick="toggleLabel()" />
<asp:Label ID="Label1" runat="server" Text="Label">test</asp:Label>
</div>
</form>
</body>
Does that do what you want?

Regards,
Kathryn
Eric wrote:
Simple problem - binding Visible property of label to Checked
property of radiobutton on the same form.
How do I do that in VS2005??
Visible="<%# radiob.Checked %>" - DOESN'T WORK
It was so simple in 2003 but how it can be done in VS05
using binding expressions. Theres no controls listing under 'Expressions'
on the designer properties window.
Please help.

Eric
Dec 7 '06 #2
Eric,
Or alternatively, in page1.aspx:
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:CheckBox ID="CheckBox1" runat="server" autopostback=true/>
<asp:Label ID="Label1" runat="server" Text="Label">test</asp:Label>
</div>
</form>
</body>

note the autopostpack=true on the checkbox

and then in the code page, page1.aspx.vb

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

If Page.IsPostBack Then
If CheckBox1.Checked Then
Label1.Visible = True
Else
Label1.Visible = False
End If
End If

Good luck,
kathryn
kbutterly wrote:
Eric,

How about something like this:

in your Page.aspx:
<head runat="server">
<title>Untitled Page</title>
<script language=javascript>
function toggleLabel() {
with (document) {
if (getElementById('CheckBox1').checked) {
getElementById('Label1').style.visibility='visible ';
}else{
getElementById('Label1').style.visibility='hidden' ;
}
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:CheckBox ID="CheckBox1" runat="server" onClick="toggleLabel()" />
<asp:Label ID="Label1" runat="server" Text="Label">test</asp:Label>
</div>
</form>
</body>
Does that do what you want?

Regards,
Kathryn
Eric wrote:
Simple problem - binding Visible property of label to Checked
property of radiobutton on the same form.
How do I do that in VS2005??
Visible="<%# radiob.Checked %>" - DOESN'T WORK
It was so simple in 2003 but how it can be done in VS05
using binding expressions. Theres no controls listing under 'Expressions'
on the designer properties window.
Please help.

Eric
Dec 7 '06 #3

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

Similar topics

3
by: Jow Blow | last post by:
Hello All, In two different books, Simple Data Binding to a control is explained with an example of a TextBox where the data is initialized with an array. For example a class is defined as...
0
by: Ian | last post by:
I have sub-classed the Page class in order to provide some base properties and methods that every page on my site will need access to. I would like to have these things show up in the Simple...
2
by: Gastin | last post by:
I am consuming a web serivce from Amazon.Com. I have the following class which was autogenerated by VS.NET when I created a Web Reference to...
1
by: Frank Yamrick | last post by:
I am trying to program an application that requires a large number of screnes that are very similar in the respect that all the bottons and labels interact with each other with the same...
4
by: Shawnk | last post by:
This post is intended to verify that true value semantics DO NOT EXIST for the Enum class (relative to boolean operations). If this is true then (thus and therefore) you can not design state...
6
by: Paul | last post by:
Hi All, Framework 1.1 listbox control unable to DataBind I've been googling for an answer to this query that appears quite a lot, but none, it seem, answers my problem directly. I am...
0
by: minnie | last post by:
An AJAX Simple Example for PHP Article from http://www.joyistar.com Introduction: AJAX WebShop 3 Beta2 supports PHP programming by integrating PHP5 development environment. Here we will give an...
0
by: opedog | last post by:
I'm monkeying around with databinding, trying to learn all the ins and outs. I'm populating a label from one of my business objects properties which is a string, however, I want some formatting done...
2
by: Aads | last post by:
Hi all, Could anyone tell me what's the advantage of binding a structure to a combobox over a simple array considering that a structure contains a parameterized constructor(of course) & then...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.