Below is some code that I do not know why it does not work. Okay, as you
can see it is simple HTML with two ASP:Label controls. Each label has some
code that basically gets a string that will be written to the browser.
ConditionalText .Eval is a method from my own library. As you can see, I
have written some static text before and after the first Eval call. If I
open this page, I get no content in the Label, even the static content. I
just get "<span id="lblScenario "
style="font-size:17px;font-weight:bold;"></span>". Now, suppose that I
remove first Eval call and open the page again, I get "<span
id="lblScenario "
style="font-size:17px;font-weight:bold;">s dfsadffdsfsda</span>", which this
time contains the static content as expected. I have even removed my
reference to Eval and just placed static content in the <% %> block and the
same thing happens. Any ideas at what the server is doing?
<form id="Form1" method="post" runat="server">
aaaaaaaa
<table>
<TR>
<TD vAlign="top">
<asp:Label id="lblScenario " Font-Size="17px" Font-Bold="True"
Runat="server"> sdfsadf<%= ConditionalText .Eval("ADMIN_MA RKET_HEADER")
%>fdsfsda</asp:Label>
<br>
<br>
<asp:Label id="lblScenario Expl" Font-Bold="False" Runat="server">
<%= ConditionalText .Eval("ADMIN_MA RKET_INSTRUCTIO N") %>
</asp:Label>
</TD>
</TR>
</table>
bbbbbbbb
</form> 2 1756
It doesn't work because ASP.NET is taking the <asp:Label x=y z=w> and creating
a method to do the instantiation and assignment of those properties on the
Label (BTW, the text inside the tags is just a Text property assignment).
This is done at creation time of the ASPX Page object. The <%%> syntax is
Rendering syntax which is done at a much later time in the page lifecycle
andn thus conflicts with the initialization code mentioned above. The idea
is that if you've gone to all the work to make this a server control, then
you'd do those sorts of assignments (dynamic or otherwide) in your code for
your page, like Page_Load. In short, the ASP.NET parser and object model
is at odds with their attempt to provide backwards classic ASP style inline
rendering syntax.
-Brock
DevelopMentor http://staff.develop.com/ballen Below is some code that I do not know why it does not work. Okay, as you can see it is simple HTML with two ASP:Label controls. Each label has some code that basically gets a string that will be written to the browser. ConditionalText .Eval is a method from my own library. As you can see, I have written some static text before and after the first Eval call. If I open this page, I get no content in the Label, even the static content. I just get "<span id="lblScenario " style="font-size:17px;font-weight:bold;"></span>". Now, suppose that I remove first Eval call and open the page again, I get "<span id="lblScenario " style="font-size:17px;font-weight:bold;">s dfsadffdsfsda</span>", which this time contains the static content as expected. I have even removed my reference to Eval and just placed static content in the <% %> block and the same thing happens. Any ideas at what the server is doing?
<form id="Form1" method="post" runat="server"> aaaaaaaa <table> <TR> <TD vAlign="top"> <asp:Label id="lblScenario " Font-Size="17px" Font-Bold="True" Runat="server"> sdfsadf<%= ConditionalText .Eval("ADMIN_MA RKET_HEADER") %>fdsfsda</asp:Label> <br> <br> <asp:Label id="lblScenario Expl" Font-Bold="False" Runat="server"> <%= ConditionalText .Eval("ADMIN_MA RKET_INSTRUCTIO N") %> </asp:Label> </TD> </TR> </table> bbbbbbbb </form>
I'm not sure to undersand what do you want to do,
but in ASP.NET sou shouldn't use <%= %> to render some dynamic content like
ASP developers used to do before ASP.NET
It is better to write the code like :
lblScenario.Tex t = "mystring"+Cond itionalText.Eva l("ADMIN_MARKET _HEADER")
and searching why or why not your result is strange is not the good question
I mean...
Sincerely,
Daniel
"Peter Rilling" <pe***@nospam.r illing.net> wrote in message
news:uT******** ******@TK2MSFTN GP12.phx.gbl... Below is some code that I do not know why it does not work. Okay, as you can see it is simple HTML with two ASP:Label controls. Each label has
some code that basically gets a string that will be written to the browser. ConditionalText .Eval is a method from my own library. As you can see, I have written some static text before and after the first Eval call. If I open this page, I get no content in the Label, even the static content. I just get "<span id="lblScenario " style="font-size:17px;font-weight:bold;"></span>". Now, suppose that I remove first Eval call and open the page again, I get "<span id="lblScenario " style="font-size:17px;font-weight:bold;">s dfsadffdsfsda</span>", which
this time contains the static content as expected. I have even removed my reference to Eval and just placed static content in the <% %> block and
the same thing happens. Any ideas at what the server is doing?
<form id="Form1" method="post" runat="server"> aaaaaaaa <table> <TR> <TD vAlign="top"> <asp:Label id="lblScenario " Font-Size="17px" Font-Bold="True" Runat="server"> sdfsadf<%= ConditionalText .Eval("ADMIN_MA RKET_HEADER") %>fdsfsda</asp:Label> <br> <br> <asp:Label id="lblScenario Expl" Font-Bold="False" Runat="server"> <%= ConditionalText .Eval("ADMIN_MA RKET_INSTRUCTIO N") %> </asp:Label> </TD> </TR> </table> bbbbbbbb </form>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: moondaddy |
last post by:
I want to use a asp Label control (or a <div runat=server> element) in a
template column of a datagrid. In the code behind in the grid's
ItemDataBound event I need to dynamically set the innerHTML of this control
with data and line breaks (<br>).
The problem is that while working in the code behind, I don't see any
properties for this control where I can set innerHTML, only text.
Any good ideas?
|
by: tshad |
last post by:
Is there another way to put labels on a page other than asp:label?
I have been building a page where I use a label to display the calculated
result of some imput. I do it using Javascript. But since the asp:label
equates to a <span> I have to create nodes to display the new text. The
problem is that as soon as I change pages (whether by post or just using a
back button), I lose whatever changes I made.
I don't have that problem with...
|
by: Shapper |
last post by:
Hello,
I am creating a contact form in ASP.NET and I need to access the labels
on Page_Load on my aspx.vb file.
The other elements such as input box and text box don't need to be
accessible.
What are the advantages of using HTML tags such as <label> over the
ASP.NET tags such as <asp:label>?
|
by: Shapper |
last post by:
Hello,
I have an Asp:Label inside the HeaderTemplate of an ASP:Repeater:
<asp:Repeater id="myRepeater" runat="server">
<HeaderTemplate>
<asp:Label id="title" runat="server"></asp:Label>
...
In my VB code I have:
Protected WithEvents title As System.Web.UI.WebControls.Label
|
by: footballhead |
last post by:
I do some design work on a website that up until to now has been
limited to defining CSS and HTML elements. Excuse me if I am using
incorrect terminology, I am just starting out in this.
I would like to try some beginning coding and the developers are giving
me some latitude to experiment. They said that I can use INLINE VB
code.
I would like to create an ASCX file that uses some labels that are on
the parent page that that ascx file...
| |
by: pagates |
last post by:
Hello All--
I have a number of <asp:Label CssClass="someclass">Text</asp:Labelcontrols
on my page. I would like them to be shown as
<div class="someclass">Text</div>
rather than
<span class="someclass">Text</span>
When it uses a span, it doesn't seem to use all the class definitions,
particularly for margins and positioning.
|
by: Guy Noir |
last post by:
So, I have a table that I only want to appear after some event has
fired. Using the asp:table control and the Visible property, this is a
piece of cake. The problem is that when I try and drop a label control
or any other asp:control to the table, the designer view gives me the
old circle and slash
saying "Nope, can't do that".
Am I correct to assume then that one cannot place an asp:control in an
asp:cell? If I am wrong here, other...
|
by: Steve Hershoff |
last post by:
I'm using VS 2003, and need to extract the text from an asp label in my
code-behind file. The label is part of a DataList's ItemTemplate.
I've noticed that in my ascx file (we're using User Controls here) I can't
set the Text property in the opening tag when writing out the
<asp:Label....</asp:Labeltags. I have to put my text between the opening
and closing tags, like you would with a regular HTML tag.
So this might be the cause of...
|
by: Dhananjay |
last post by:
hi all
i have a problem on populating a message on asp:label server control.I
am able to insert records into the table.but it is not populating any
message like "Records entered successfully". i wanted to implement
this .how to proceed can anybody tell me about this . i am using
asp.net/vb.net 2.0
here i am providing the code also:-
|
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...
|
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...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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...
| |