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

Home Posts Topics Members FAQ

Binding Expressions

20 New Member
Hello,

If I wanted to use a method and return a value to use as a property value to a control like this.

Expand|Select|Wrap|Line Numbers
  1. <asp:Label ID="test" runat="server" Visible='<%#IsVisible()%'></asp:Label>
Will this work? And why doesn't this work

Expand|Select|Wrap|Line Numbers
  1. <asp:Label ID="test" runat="server" Visible='<%=IsVisible()%'></asp:Label>
Can you explain what happens between # and = and the difference.

Thanks
Jan 8 '10 #1
1 1395
Frinavale
9,735 Recognized Expert Moderator Expert
This:
Expand|Select|Wrap|Line Numbers
  1. <%=  %>
Is shorthand for Response.Write()...it's shorthand for this:
Expand|Select|Wrap|Line Numbers
  1. <%Response.Write("...")%>
Therefore this won't work in your code.

However this:
Expand|Select|Wrap|Line Numbers
  1. <%#  %>
Is used for binding to a data source. This will work. See this article on ASP.NET data binding.
Jan 11 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
1603
by: enki | last post by:
I have been doing some reading on dynamic bindind and polymorphism. I know the basics from what I have seen in books. The way virtual methods were explained was that they were used when methods...
11
4808
by: JV | last post by:
I just converted a big web project from VB.NET to C# and I got some very strange runtime errors. Apparently, throughout the ASPX pages, the VB version of this project used the expression <%#...
0
1442
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
2303
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...
2
8727
by: Philip | last post by:
I can use a GridView and ObjectDataSource to bind my data using "Eval" expressions ... provided the GridView and related Column TemplateFields are defined as inline HTML. I prefer to...
2
1625
by: Eric | last post by:
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...
8
11953
by: =?Utf-8?B?QXNo?= | last post by:
Hi, I have an object, for example User. User contains various properties which i have been able to bind to successfully using wizards and the form view. However if the class User has a property...
0
2424
by: CSharpner | last post by:
How can I do the following?: Have a label on a form have its Text property bound to a setting from one of my DLL library's config files? I've followed these instructions to successfully get...
6
4573
by: Tomasz J | last post by:
Hello developers, I bind my TextBox control specyfying a format stored in my application global ApplicationContext object - it has a static string CurrencyFormat property. The problem - this...
26
2777
by: Aaron \Castironpi\ Brady | last post by:
Hello all, To me, this is a somewhat unintuitive behavior. I want to discuss the parts of it I don't understand. .... f= lambda: n .... 9 9
0
7116
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,...
0
7161
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...
0
7275
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...
0
5418
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,...
1
4857
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
4551
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
3058
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3063
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
247
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...

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.