PDA

View Full Version : [CLOSED] Portlet Listeners with Razor



andreasperanza
Sep 13, 2012, 11:42 AM
Hi,

I can't find a way to intercept Portlet expand event in Razor. I just want to do something like this code example (it works with Panel instead of Portlet) :



Html.X().Portlet()
.Listeners(l => l.Expand.Handler = "alert('ok');")


I tried "AddListener" and "On", but they don't work.

How can I do..?

Thanks

Daniil
Sep 13, 2012, 2:59 PM
Hi,

The Expand event is triggered when I expand the Portlet in the example below.

Please provide your test case.

Example

<!DOCTYPE html>

<html>
<head>
<title>Ext.Net.MVC v2 Example</title>
</head>
<body>
@Html.X().ResourceManager()

@(Html.X().Portal()
.Width(200)
.Height(200)
.Items(
Html.X().PortalColumn()
.Items(
Html.X().Portlet()
.Title("Portlet")
.Collapsed(true)
.Listeners(ls =>
ls.Expand.Handler = "alert('Expand')"
)
)
)
)
</body>
</html>

andreasperanza
Sep 13, 2012, 4:55 PM
This is an example :



@{
ViewBag.Title = "Index";
}

<!DOCTYPE html>
<html>
<head>
<title>@ViewBag.Title</title>
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
</head>
<body>
@Html.X().ResourceManager()

<div>
@(Html.X().Panel()
.Items(panel => {
panel.Add(Html.X().Portal()
.Border(false)
.Layout(LayoutType.Column)
.Items(portal => {
portal.Add(Html.X().PortalColumn()
.ColumnWidth(1)
.Layout(LayoutType.Anchor)
.Items(portalColumn =>
{
portalColumn.Add(
Html.X().Portlet()
//Html.X().Panel()
.CloseAction(CloseAction.Hide)
.Collapsible(true)
.Closable(true)
.Listeners(l => l.Expand.Handler = "alert('ok');")
.Title("Title")
);
})
);
})
);
}
)
)

</div>
</body>
</html>



The compiler says that 'Ext.Net.Portlet.Builder' doesn't conteins a definition for 'Listeners' and there's no extension methods.

It works if I use Html.X().Panel() instead of //Html.X().Portlet()

andreasperanza
Sep 13, 2012, 4:57 PM
Your example doesn't work with Portlet, neither with Panel...

Vladimir
Sep 13, 2012, 7:06 PM
I can confirm that Danill's example works correctly
What version do you use?
I recommend to update from 2.1 branch
http://svn.ext.net/premium/branches/2.1

andreasperanza
Sep 14, 2012, 9:49 AM
Uhmmmm ok, so the problem is my version.

I use NuGet to install Ext.Net on my projects, version is 2.0.0rc2.

I tried to get the latest in SVN using my forum credentials, but username and password seem to be invalid: aren't them the same?

Daniil
Sep 14, 2012, 12:06 PM
Yes, they are different. The SVN credentials should be sent to you when you got the Premium Support Subscription.

Please check the Inbox. If they are lost, please send a request with your forum name to:
support@object.net