PDA

View Full Version : [CLOSED] Set label.Html from code behind



MarcA
Dec 18, 2013, 10:46 AM
Hi,

I'm trying to set the Html property in the code behind. Instead of showing as html is shows the tags. When I set the Html in the markup it does work.

I'm using the new <bin> feature to keep my code modular.

What shoud I change to get this to work correctly?

Marc



<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestNetHtml.aspx.cs" %>
<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<script runat="server" language="c#">
protected void ShowWindowA(object sender, DirectEventArgs e)
{
lbHtmlInfo.Html = "<br/> This does not work </b>";
winA.Show();
}
protected void ShowWindowB(object sender, DirectEventArgs e)
{
winB.Show();
}
</script>

<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">

<ext:ResourceManager ID="ResourceManagerExt" runat="server" />

<ext:Panel runat="server" Title="Popup">
<Items>
<ext:Button runat="server" Text="ShowPopupA">
<DirectEvents>
<Click OnEvent="ShowWindowA"></Click>
</DirectEvents>
</ext:Button>

<ext:Button runat="server" Text="ShowPopupB">
<DirectEvents>
<Click OnEvent="ShowWindowB"></Click>
</DirectEvents>
</ext:Button>
</Items>
<Bin>

<ext:Window ID="winA" runat="server" Width="500" Modal="True" Layout="Form" Title="Does not work" DefaultRenderTo="Body" Resizable="False">
<Items>
<ext:Label ID="lbHtmlInfo" runat="server" Height="200"></ext:Label>
<ext:FormPanel runat="server" Border="False" DefaultAnchor="95%" BodyPadding="10" LabelWidth="200">
<Items>
<ext:TextField runat="server" Flex="1" FieldLabel="Period" />
</Items>
</ext:FormPanel>
</Items>
<Buttons>
<ext:Button ID="Button2" runat="server" Text="Close" Handler="#{winA}.close();" />
</Buttons>
</ext:Window>


<ext:Window ID="winB" runat="server" Width="500" Modal="True" Layout="Form" Title="Works" DefaultRenderTo="Body" Resizable="False">
<Items>
<ext:Label ID="Label1" runat="server" Html="<b>This works</b>" Height="200"></ext:Label>
<ext:FormPanel ID="FormPanel1" runat="server" Border="False" DefaultAnchor="95%" BodyPadding="10" LabelWidth="200">
<Items>
<ext:TextField ID="TextField1" runat="server" Flex="1" FieldLabel="Period" />
</Items>
</ext:FormPanel>
</Items>
<Buttons>
<ext:Button ID="Button1" runat="server" Text="Close" Handler="#{winB}.close();" />
</Buttons>
</ext:Window>
</Bin>
</ext:Panel>

</form>
</body>
</html>

blueworld
Dec 18, 2013, 10:53 AM
try



lbHtmlInfo.Update("<br/> This does not work </b>")


instead of



lbHtmlInfo.Html = "<br/> This does not work </b>"

Daniil
Dec 18, 2013, 1:02 PM
Hi everybody,

Yes, the Update call can help. Thank you for the attention, @blueworld!

Though, I think it is a defect. Fixed in the trunk.

Also you missed an opening <b> tag here:

lbHtmlInfo.Html = "<br/> This does not work </b>"

MarcA
Dec 18, 2013, 4:32 PM
Thank you.

lbHtmlInfo.Update() Solved my problem.

Marc