PDA

View Full Version : Code behind setting Title property on portlet fails



netwearcdz
Jan 15, 2010, 2:04 PM
Hey guys,
When i set the portlet title property from the code behind i get a JS error and the page doesn't render. but if i set the title in design mode it works great how can i programmatic ally set the title.

Note the issue only come-in when i'm setting a title (from code behind) that looks like this "Something : Part - A"



// Fails ON CLIENT
NewPortlet.Title = "Something : Part - A";
// WORKS.
NewPortlet.Title = "Something Part A";

<ext:Portlet ID="Portlet11" Title="Something : Part - A" runat="server" HideCollapseTool="true">
<Tools>
<ext:Tool Type="Search" Handler="" />
</Tools>
</ext:Portlet>


Any idea how to get around this?

geoffrey.mcgill
Jan 15, 2010, 2:42 PM
I tried the following and it appears to work correctly.

Example


<%@ Page Language="C#" %>

<%@ Register assembly="Coolite.Ext.Web" namespace="Coolite.Ext.Web" tagprefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
protected void Button1_Click(object sender, AjaxEventArgs e)
{
this.Portlet1.Title = "Something : Part - A";
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Coolite Toolkit Examples</title>
</head>
<body>
<form runat="server">
<ext:ScriptManager runat="server" />

<ext:Portal runat="server" Border="false">
<Body>
<ext:ColumnLayout runat="server">
<ext:LayoutColumn>
<ext:PortalColumn runat="server">
<Body>
<ext:AnchorLayout runat="server">
<ext:Anchor>
<ext:Portlet
ID="Portlet1"
runat="server"
Title="Panel 1"
BodyStyle="padding:5px;"
Html="Portal 1"
Height="185"
Width="350">
<Buttons>
<ext:Button ID="Button1" runat="server" Text="Test">
<AjaxEvents>
<Click OnEvent="Button1_Click" />
</AjaxEvents>
</ext:Button>
</Buttons>
</ext:Portlet>
</ext:Anchor>
</ext:AnchorLayout>
</Body>
</ext:PortalColumn>
</ext:LayoutColumn>
</ext:ColumnLayout>
</Body>
</ext:Portal>
</form>
</body>
</html>

netwearcdz
Jan 15, 2010, 3:31 PM
when i am doing it is the initial load of the page and its components i notice in your example you are doing via a ajax method?

geoffrey.mcgill
Jan 15, 2010, 3:36 PM
Seems to work fine during the initial Page_load as well.

Can you modify my above sample to demonstrate how to reproduce the issue. Once we're able to reproduce the issue with a full .aspx sample we can offer some more suggestions.