Embed flexmonster in asp.net WebForms (not mvc)

Answered
Simon asked on May 23, 2017

Hello,
we want embed javascript flexmonster files to the ASP.NET project. The problem is the next error: Uncaught TypeError: $(...).flexmonster is not a function.
Our example:
Site.Master:
<head runat="server">
...
<link href="../PT/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../PT/client/flexmonster/lib/jquery.min.js"></script>
<script type="text/javascript" src="../PT/client/flexmonster/flexmonster.js"></script>
...
</head>
 
Default.aspx:
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<div id="pivotContainer"></div>
<script type="text/javascript">
var pivot = $("#pivotContainer").flexmonster({
toolbar: true,
report: {
dataSource: {
dataSourceType: "microsoft analysis services",
proxyUrl: "http://172.18.48.80:8085/msmdpump.dll",
catalog: "MPSA_Mcube",
cube: "PostajaPotniki",
binary: false
}
},
licenseKey: "Z767-XB403R-4W3W35-6E6K00"
});
</script>
</asp:Content>
 
It is possible to include flexmonster in ASP.NET?
 
Thank you!
Best regards,
Simon
 

6 answers

Public
Dmytro Zvazhii Dmytro Zvazhii Flexmonster May 23, 2017

Hello Simon,
Thank you for your question. We prepared a sample WebForms project for you.
Please let us know if everything works fine for you.
Best regards,
Dmytro.

Public
Simon May 25, 2017

Hi Dmytro,
Thanks for a sample.
 
Just one more question. If we have a project where it is more than one javaScript files. In this order:
 
 
<script language="javascript" type="text/javascript" src="<%= Request.ApplicationPath.TrimEnd('/') %>/script/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="<%= Request.ApplicationPath.TrimEnd('/') %>/script/prototype.js"></script>
<script language="javascript" type="text/javascript" src="<%= Request.ApplicationPath.TrimEnd('/') %>/script/common.js"></script>
<script language="javascript" type="text/javascript" src="<%= Request.ApplicationPath.TrimEnd('/') %>/script/scriptaculous.js"></script>
<script language="javascript" type="text/javascript" src="<%= Request.ApplicationPath.TrimEnd('/') %>/script/data.js"></script>
<script language="javascript" type="text/javascript" src="<%= Request.ApplicationPath.TrimEnd('/') %>/script/kivimenu.js"></script>
<script language="javascript" type="text/javascript" src="<%= Request.ApplicationPath.TrimEnd('/') %>/script/kcpagestate.js"></script>
<script language="javascript" type="text/javascript" src="<%= Request.ApplicationPath.TrimEnd('/') %>/script/kcnotify.js"></script>
<script language="javascript" type="text/javascript" src="<%= Request.ApplicationPath.TrimEnd('/') %>/script/valid.js"></script>
<script language="javascript" type="text/javascript" src="<%= Request.ApplicationPath.TrimEnd('/') %>/script/number.aspx"></script>
<script language="javascript" type="text/javascript" src="<%= Request.ApplicationPath.TrimEnd('/') %>/security/permissions.aspx"></script>
<script language="javascript" type="text/javascript" src="<%= Request.ApplicationPath.TrimEnd('/') %>/script/xregexp.js"></script>
<script language="javascript" type="text/javascript" src="<%= Request.ApplicationPath.TrimEnd('/') %>/flexmonster/flexmonster.js"></script>
 
There is an error, because we think that the prototype.js use the same functions in the jquery.min.js, just like flexmonster.js. Could you tell us which functions in flexmonster use which jquery functions?
 
Thanks!
Best regards,
Simon

Public
Simon May 25, 2017

One of te solution is:
 
<div id="<%= ClientID %>pivotContainer1"></div>
 
<script type="text/javascript">
var j$ = jQuery.noConflict();
j$("#<%= ClientID %>pivotContainer1").flexmonster({
report: {
dataSource: {
dataSourceType: "microsoft analysis services",
proxyUrl: "http://172.18.48.80:8085/msmdpump.dll",
catalog: "MPSA_Mcube",
cube: "Valdiacija",
binary: false,
},
slice: {
...
}
options {...}
},
componentFolder: "https://cdn.flexmonster.com/2.3/"
});
</script>
 
But then we have the next error:
 
flexmonster.js:9 Uncaught TypeError: Cannot read property 'uniqueName' of undefined
at E.z9.KX (flexmonster.js:9)
at E.z9.ZH (flexmonster.js:9)
at E.ZH (flexmonster.js:9)
at E.z9.xg (flexmonster.js:9)
at Z.B5.FN (flexmonster.js:9)
at Z.B5.$E (flexmonster.js:9)
at Z.B5.mA (flexmonster.js:9)
at Z.B5.load (flexmonster.js:9)
at Z.B5.lm (flexmonster.js:9)
at i0.u8.dispatch (flexmonster.js:9)
 
Best regards,
Simon

Public
Tanya Gryshko Tanya Gryshko Flexmonster May 25, 2017

Hello Simon,
Thank you for writing. It seems that prototype.js library also uses $ as a function or variable name. For this particular case, we recommend embedding our component using jQuery("#pivotContainer").flexmonster instead of $("#pivotContainer").flexmonster . Please let us know if it works for you.
Regards,
Tanya

Public
Simon May 29, 2017

Hi Tanya,
Thanks for the answer, but the error is still the same.
 
flexmonster.js:9 Uncaught TypeError: Cannot read property ‘uniqueName’ of undefined
at E.z9.KX (flexmonster.js:9)
at E.z9.ZH (flexmonster.js:9)
at E.ZH (flexmonster.js:9)
at E.z9.xg (flexmonster.js:9)
at Z.B5.FN (flexmonster.js:9)
at Z.B5.$E (flexmonster.js:9)
at Z.B5.mA (flexmonster.js:9)
at Z.B5.load (flexmonster.js:9)
at Z.B5.lm (flexmonster.js:9)
at i0.u8.dispatch (flexmonster.js:9)
 
Regards,
Simon

Public
Dmytro Zvazhii Dmytro Zvazhii Flexmonster May 29, 2017

Hello Simon,
Thank you for your quick reply. Could you please check the connection to your OLAP cube on the demo version from the package or on the demos on our web page - https://www.flexmonster.com/demos/js/pivot-table/ ? If there are no errors there, it means that the issue is related to the jQuery library. Otherwise, if the problem occurs it means that the issue is related to your cube data and we need the access to your cube so we can reproduce the issue on our side.
Waiting for the update from you.
Best regards,
Dmytro.

Please login or Register to Submit Answer