Feb 20, 2010, 4:47 PM
[CLOSED] [1.0] MVC and Scripts
Hello vladimir,
Just wanted to bring it to your attention, not sure if anything can be done, just give me a no if that's the case ... but the following fails. I know why, because we are evaluating all of the javascript as a single line ... but hey just want to know if there is a way around it [Smile]
Index.aspx:
Just wanted to bring it to your attention, not sure if anything can be done, just give me a no if that's the case ... but the following fails. I know why, because we are evaluating all of the javascript as a single line ... but hey just want to know if there is a way around it [Smile]
Index.aspx:
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Example</title>
<script type="text/javascript">
function LoadContent() {
Ext.Ajax.request( {
params: {
containerId: 'Panel1'
},
scripts: true,
success: function(r) {
eval(r.responseText);
},
url: '/Example/Example'
} );
}
</script>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Panel ID="Panel1" runat="server"
Height="250"
Layout="Fit"
Title="Example"
Width="500">
<Buttons>
<ext:Button ID="Button1" runat="server" Text="Load">
<Listeners>
<Click Fn="LoadContent" />
</Listeners>
</ext:Button>
<ext:Button ID="Button2" runat="server" Text="Clear">
<Listeners>
<Click Handler="#{Panel1}.removeAll();" />
</Listeners>
</ext:Button>
</Buttons>
</ext:Panel>
</body>
</html>
Example.ascx:<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Import Namespace="Suite.Web" %>
<script type="text/javascript">
var myExample = function() {
alert('Hello World');
}
myExample();
</script>
<ext:TextField ID="Example" runat="server" />
Also, would you happen to know why a button directevent (click) success property would not be able to see myExample ? I keep getting myExample is undefined with the following:<ext:Button ...>
<Listeners>
<Click ... Success="myExample()" />
</Listeners>
</ext:Button>
Cheers,