473,385 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

<%# IsEditable %> and <%= IsEditable %>

Hi,

When I use this tag:

<asp:lable . Visible='<%# IsEditable %>'

I have to do DataBind so the binding takes place.

I am trying to use the following notation to do the similar thing without
forced to call DataBind method:

<asp:lable . Visible='<%= IsEditable %>'

But I receive this error:

Generation of designer file failed: Cannot create an object of type
'System.Boolean' from its string representation '<%= IsEditable %>' for the
'Visible' property.

Is there any way to use <%= IsEditable %instead of <%# IsEditable % to
avoid calling the DataBind?

Thank you,

Max

Sep 13 '07 #1
7 4659
<%=expression% is executed at render-time, and is meant to output literal
stuff, not to set property values. You certainly could set it in code, but
it removes completely the point of using separate variable.

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"Max2006" <al*******@newsgroup.nospamwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Hi,

When I use this tag:

<asp:lable . Visible='<%# IsEditable %>'

I have to do DataBind so the binding takes place.

I am trying to use the following notation to do the similar thing without
forced to call DataBind method:

<asp:lable . Visible='<%= IsEditable %>'

But I receive this error:

Generation of designer file failed: Cannot create an object of type
'System.Boolean' from its string representation '<%= IsEditable %>' for
the 'Visible' property.

Is there any way to use <%= IsEditable %instead of <%# IsEditable % to
avoid calling the DataBind?

Thank you,

Max

Sep 13 '07 #2

Thank you for help.

Do you know any resource that allows me monitor - or spy into - when / how
these bindings happen?

If you know any online resource that explains the depth of the binding in
ASP.NET, that would be really helpful. I like to know binding beyond the
syntaxes.

Thank you,
Max


"Teemu Keiski" <jo****@aspalliance.comwrote in message
news:uU*************@TK2MSFTNGP02.phx.gbl...
<%=expression% is executed at render-time, and is meant to output
literal stuff, not to set property values. You certainly could set it in
code, but it removes completely the point of using separate variable.

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"Max2006" <al*******@newsgroup.nospamwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>Hi,

When I use this tag:

<asp:lable . Visible='<%# IsEditable %>'

I have to do DataBind so the binding takes place.

I am trying to use the following notation to do the similar thing without
forced to call DataBind method:

<asp:lable . Visible='<%= IsEditable %>'

But I receive this error:

Generation of designer file failed: Cannot create an object of type
'System.Boolean' from its string representation '<%= IsEditable %>' for
the 'Visible' property.

Is there any way to use <%= IsEditable %instead of <%# IsEditable %>
to avoid calling the DataBind?

Thank you,

Max


Sep 13 '07 #3
Now that we are discussing about expressions, something like that could in
fact help you: http://msdn2.microsoft.com/en-us/library/d5bd1tad.aspx

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"Max2006" <al*******@newsgroup.nospamwrote in message
news:OK**************@TK2MSFTNGP04.phx.gbl...
>
Thank you for help.

Do you know any resource that allows me monitor - or spy into - when / how
these bindings happen?

If you know any online resource that explains the depth of the binding in
ASP.NET, that would be really helpful. I like to know binding beyond the
syntaxes.

Thank you,
Max


"Teemu Keiski" <jo****@aspalliance.comwrote in message
news:uU*************@TK2MSFTNGP02.phx.gbl...
><%=expression% is executed at render-time, and is meant to output
literal stuff, not to set property values. You certainly could set it in
code, but it removes completely the point of using separate variable.

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"Max2006" <al*******@newsgroup.nospamwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>>Hi,

When I use this tag:

<asp:lable . Visible='<%# IsEditable %>'

I have to do DataBind so the binding takes place.

I am trying to use the following notation to do the similar thing
without forced to call DataBind method:

<asp:lable . Visible='<%= IsEditable %>'

But I receive this error:

Generation of designer file failed: Cannot create an object of type
'System.Boolean' from its string representation '<%= IsEditable %>' for
the 'Visible' property.

Is there any way to use <%= IsEditable %instead of <%# IsEditable %>
to avoid calling the DataBind?

Thank you,

Max



Sep 13 '07 #4
no.

<%= expression %is translated to:

Controls.Add(new Label(expression));

where <asp:label id=lb1 Visible=<%=expression%/is translated to:

lb1 = new Label();
lb1.Visible = "<%=expression%>";

and when databind is called, it checks for properties with binding
expressions, evals the expression, and sets the property to the value.

-- bruce (sqlwork.com)

Max2006 wrote:
Hi,

When I use this tag:

<asp:lable . Visible='<%# IsEditable %>'

I have to do DataBind so the binding takes place.

I am trying to use the following notation to do the similar thing without
forced to call DataBind method:

<asp:lable . Visible='<%= IsEditable %>'

But I receive this error:

Generation of designer file failed: Cannot create an object of type
'System.Boolean' from its string representation '<%= IsEditable %>' for the
'Visible' property.

Is there any way to use <%= IsEditable %instead of <%# IsEditable % to
avoid calling the DataBind?

Thank you,

Max
Sep 13 '07 #5
Hi Max,

A tip on inspecting the generated class from a WebForm is to first
precompile the website and use Reflector
(http://www.aisto.com/roeder/dotnet/) to view the source code of the
WebForm:

aspnet_compiler -v / -p c:\projects\website1 c:\temp\website1
reflector c:\temp\website1\bin\*.dll
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 14 '07 #6
Thanks Bruce for reply.

At this point, the outcome of <asp:label id=lb1 Visible=<%=expression%/>
is the error I mentioned. It doesn't work!

"bruce barker" <no****@nospam.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
no.

<%= expression %is translated to:

Controls.Add(new Label(expression));

where <asp:label id=lb1 Visible=<%=expression%/is translated to:

lb1 = new Label();
lb1.Visible = "<%=expression%>";

and when databind is called, it checks for properties with binding
expressions, evals the expression, and sets the property to the value.

-- bruce (sqlwork.com)

Max2006 wrote:
>Hi,

When I use this tag:

<asp:lable . Visible='<%# IsEditable %>'

I have to do DataBind so the binding takes place.

I am trying to use the following notation to do the similar thing without
forced to call DataBind method:

<asp:lable . Visible='<%= IsEditable %>'

But I receive this error:

Generation of designer file failed: Cannot create an object of type
'System.Boolean' from its string representation '<%= IsEditable %>' for
the 'Visible' property.

Is there any way to use <%= IsEditable %instead of <%# IsEditable %>
to avoid calling the DataBind?

Thank you,

Max

Sep 14 '07 #7
Hi Max,

lbl1.Visible = "<%= expression %>";

is not a data binding expression, that's why it doesn't work.
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 17 '07 #8

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

Similar topics

9
by: Francesco Moi | last post by:
Hello. I'm trying to build a RSS feed for my website. It starts: ----------------//--------------------- <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE rss PUBLIC "-//Netscape...
1
by: Christian Schmidbauer | last post by:
Hello! I prepare my XML document like this way: ------------------------------------------------------- PrintWriter writer; Document domDocument; Element domElement; // Root tag
2
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are...
2
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script...
0
by: Arne Schirmacher | last post by:
I want to display a MySQL database field that can contain HTML markup. If I use <esql:get-string> then I get all of the database field, but all tags are escaped which is not what I want. If I use...
4
by: higabe | last post by:
Three questions 1) I have a string function that works perfectly but according to W3C.org web site is syntactically flawed because it contains the characters </ in sequence. So how am I...
34
by: Mark Moore | last post by:
It looks like there's a pretty serious CSS bug in IE6 (v6.0.2800.1106). The HTML below is validated STRICT HTML 4.01 and renders as I would expect in Opera, FrontPage, and Netscape. For some...
11
by: Les Paul | last post by:
I'm trying to design an HTML page that can edit itself. In essence, it's just like a Wiki page, but my own very simple version. It's a page full of plain old HTML content, and then at the bottom,...
6
by: tentstitcher | last post by:
Hi all: I have a source xml document with an element of type string. This element contains something like the following: <stringData> &lt;Header&gt; &lt;Body&gt; </stringData> I would like to apply an...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.