Runtime Error in VS2012 (Update4) LightSwitch HTML Client
I have a desktop (Silverlight) application, I upgraded the project to add the HTML Client. Now when I run the HTML Client, it shows this message box on the browser:
"The application could not be loaded. Please try refreshing the page. Failed to load model: failed to parse the model JSON string. Failure reason: syntax error."
I started my desktop application in VS2012 Update 2, and now it is in the Update 4. The interesting thing is that when I make new Project and then add HTML Client, I will not receive this error and it works fine.
It shows this error only on that specific project (Which I started on VS2012 Update2, later Update3 and now Update4) and that project is very big (more than 100 tables and screens), therefore I can not make that from scratch again.
I have to add HTML Client to my project. I really appreciate if someone can help me.
"The application could not be loaded. Please try refreshing the page. Failed to load model: failed to parse the model JSON string. Failure reason: syntax error."
Hi Keysen,
First you need install Microsoft.LightSwitch.Client.JavaScript.Runtime 2.5.2. This update can be downloaded from the NuGet Gallery, see:
http://www.nuget.org/packages/Microsoft.LightSwitch.Client.JavaScript.Runtime/
Because this issue is project specific, you can also turn the build output, in the
Options window, find Projects and Solutions >>
Build and Run. Find Diagnostic in the drop-down for MSBuild project build output verbosity. It will give detailed information why this happens.
Please let me know if there is anything that I can do to help.
Best regards,
Angie
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Similar Messages
-
SSRS reports from Lightswitch Html Client
I have created a Lightswitch desktop application that list the available reports that are stored in a table and also provides a button that when clicked launches the web browser to the URL for the report on the SQL server. My problem is now I'm trying to
create the HTML client for the application and have no experience with Java Script. Does anyone know how to accomplish the something that I did on the desktop application on the HTML client?
Below is the code that I used to open the URL in the browser in the desktop application.
Imports Microsoft.LightSwitch.Threading
Imports System.Runtime.InteropServices.Automation
Namespace LightSwitchApplication
Public Class ListReports
Private Sub RunReport_Execute()
' Write your code here.
Dim uri As New Uri(ReportsSet.SelectedItem.ReportAddress) 'website stored in the ReportsSet.ReportAddress field
If (AutomationFactory.IsAvailable) Then
Dim shell = AutomationFactory.CreateObject("Shell.Application")
shell.ShellExecute(uri.ToString)
ElseIf (Not System.Windows.Application.Current.IsRunningOutOfBrowser) Then
System.Windows.Browser.HtmlPage.Window.Navigate(uri, "_blank")
End If
End Sub
End Class
End NamespaceThis may help:
Creating Reports in LightSwitch HTML Client
// Show Loading message
var LoadingDiv = $("<div></div>");
var Loading = $("<h1> Loading Report...</h1>");
Loading.appendTo(LoadingDiv);
LoadingDiv.appendTo($(element));
// Get Report
var HTMLContent = $("<div></div>").html(
"<object width='650px' height='650px' data='../reports/ReportViewer.aspx?SurveyId="
+ contentItem.screen.SurveyId + "'/>"
// Make report appear on top of the Loading message
HTMLContent.css({
"margin-top": "-50px"
HTMLContent.appendTo($(element));
Unleash the Power - Get the LightSwitch 2013 HTML Client / SharePoint 2013 book
http://LightSwitchHelpWebsite.com -
Lightswitch HTML Client - Detail picker for each related List Item
I have a doubt in Lightswitch Html Client application.
Scenario:
Suppose i have two tables "Property" and "PropertyVaues".
A Property can have many PropertyValues is the relationship between them.
I want to show the data on screen like below:
Property List:
XYZ [___10____(+)]
MNO [___abc____(+)]
PQR [___30.5___(+)]
Xyz is the list item
assume [___10____(+)] is the detail picker of
PropertyValues which allow to select one value related to
XYZ Property item, and same for other list items.
Only Related "PropertyValues" for each list item must be available in the detail picker.
Please help me out if any one has the solution to solve it.
Or you can give me any other way to accomplish the above scenario.
ThanksHello Josh,
I am implementing it on AddEdit screen.
(1)
(2)
Screen description:
[Note: Some Images are in my next post]
1. Image(1) shows the list of properties (GSM, Mill Name, CMS). These Properties have its respective property values in drop down.
2. When i select any value from the dropdown list (eg. 10 from GSM). the value is assigned to all other drop down.
[shown in image(3) next post]
(4) Again when suppose i select value for "Mill Name" Property as "Abc", it is assigned to all other drop down.
[shown in image(4) next post]
I want that a property value must be assigned to its respective Property only.
Please help me on this. Or suggest me another way out to accomplish such scenario.
Thanks
Ravi Patel -
Extending Screens for Multi-Select in the LightSwitch HTML Client
Hi i
read Mike Droney's article of
Extending Screens for Multi-Select in the LightSwitch HTML Client
But i just want to understand the code, so what is the ‘__isSelected’ property? from where does it come?
why does the contentItem.value.details have an ‘__isSelected’ property?
is the value of the contentItem not the screen?
and also how can i implement the ‘Can Execute Code’ only if one or more check boxes are checked?
ThanksBut i just want to understand the code, so what is the ‘__isSelected’ property? from where does it come?
why does the contentItem.value.details have an ‘__isSelected’ property?
is the value of the contentItem not the screen?
and also how can i implement the ‘Can Execute Code’ only if one or more check boxes are checked?
The '__isSelected' property is a private member of the class msls.ContentItem related to the backing data for the selected item. That is to say, it would be a private member if JavaScript actually had encapsulation and information hiding like a typical
object-oriented language. I like to reference David Herman's description from his book
Effective JavaScript:
Often, JavaScript programmers resort to coding conventions rather than any absolute enforcement mechanism for private properties. For example, some programmers use naming conventions such as prefixing or suffixing private property names with an underscore
character (_). This does nothing to enforce information hiding, but it suggests to well-behaved users of an object that they should not inspect or modify the property so that the object can remain free to change its implementation.
...which means that it's generally not recommended to directly get or set backing data properties like __isSelected, instead working with the public property 'selectedItem', although it may work fine in certain cases like this one.
To make _canExecute fire only when an item in the list is selected to enable a button method, try:
return (screen.Contacts.selectedItem !== null); -
How to access the C# file in server from Lightswitch HTML Client
Hi,
In that LightSwitch HTML Application i have some c# file in the server project.How can i access those C# file in the screens (HTML Client project )
thanks,
goblalakrishnan s
gobalakrishnan SHi,
with implementing Generic File Handlers (.ashx)
See follow link:
http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/174/Full-Control-LightSwitch-ServerApplicationContext-And-Generic-File-Handlers-And-Ajax-Calls.aspx
regards
j.nord -
'Days Elapsed' computed field in lightswitch HTML client
I am developing a simple lightswitch HTML application to keep track of research experiments. I have a table called 'Experiments' and one of the fields is 'ExperimentDate'. I want to display the number of days that have passed since the date of experiment.
Is there any way to do this?Use a custom control to display 'ExperimentDate' and display the calculation. Use in-built JavaScript datetime functions or add a JavaScript library such as moment.js. Similar to this MSDN article sections:
Format a Date
Moment.js
You can see the use in this
stackoverflow post.
var date1 = new Date("02/Feb/2015 00:00:00"),
date2 = new Date("25/Feb/2015 10:09:00"),
diff = date2.getTime() - date1.getTime(),
days = Math.floor(diff / (1000 * 60 * 60 * 24));
Cheers
Dave
Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer. -
LightSwitch HTML Client pubished on azure get an 400.0 bad request error
Well, I have this problem: "Request failed with status code '400' and the status text 'Bad Request'." when I run my LightSwitch HTMLClient application that are published in Azure Web Applications.
I already look everywhere for 3 days and still could not find the answer to this problem.
I hope someone in this forum can help me.
Thanks.Hi, thank you for respond.
let's see, the fiddler throws these:
NOTICE: Don't follow the links, they are dummies
GET http://myapp.azurewebsites.net/ApplicationData.svc/$metadata
400 Bad Request (text/html)
The Request
GET /ApplicationData.svc/$metadata HTTP/1.1
MaxDataServiceVersion: 3.0
Accept: application/xml
Referer: http://myapp.azurewebsites.net/HTMLClient/default.htm
Accept-Language: es-MX,es;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
Connection: Keep-Alive
Host: myapp.azurewebsites.net
Cookie: ARRAffinity=354b4b5b87b2f1e4e8b6c19a5566c6e055bf3e4047b54b4d2ea846ba1b33d561; msls-client-parameters=preferredLanguage=es-MX; ASP.NET_SessionId=bkf52whz0rkufhcxmqrfuirm
The Response
HTTP/1.1 400 Bad Request
Cache-Control: private
Content-Type: text/html
Server: Microsoft-IIS/8.0
X-AspNet-Version: 4.0.30319
X-Content-Type-Options: nosniff
X-Powered-By: ASP.NET
Date: Wed, 01 Apr 2015 04:23:39 GMT
Content-Length: 1647
Connection: Keep-Alive
The azure logs, the lightswitch diagnostic and the debugger not show any difference from these. -
Lightswitch HTML Client - beforeApplyChanges only fires once
Hi,
I have a standard Add/Edit screen created by Visual Studio with the standard save button in the top right-hand corner. In my beforeApplyChanges function I have the following code:
if (!screen.OrderAllocation.OfflineAdType) {
screen.findContentItem("OfflineAdType").validationResults = [
new msls.ValidationResult(
screen.OrderAllocation.details.properties.OfflineAdTypes,
"This is a required field")];
return false;
This fires correctly if someone tries to save the object without an OfflineAdType. However, if they then correct the error by editing it within the screen, and then click on the standard save button - a message box pops up saying there's validation errors
on the page. BeforeApplyChanges isn't called.
How do I clear these validation errors beforehand?You need to clear the validation results. You can also add a change listener to update any time the value changes. See the answer to this post.
https://social.msdn.microsoft.com/Forums/en-US/08af462d-a094-44b2-bf3c-a3cd5f7a40a9/hmtl-client-screen-validation?forum=lightswitch -
Hi,
I have this code which is adding a record and re-loading a navigation property "ldDailyLogDetails_FK".
afterClosed:
function (viewScreen, navigationAction) {
if
(navigationAction === msls.NavigateBackAction.commit) {
screen.ldDailyLogDetails_FK.load();
It successfully adds a record and then redisplays this new record on all browsers, but on my phone it adds the record ok, but sometimes, it dosnt seem to refresh (or load) the page with the new record.
I also wonder if there is any place I might go to get some "phone vs desktop browser" information and advice?
I have tried screen.ldDailyLogDetails_FK.refresh(); as well.
davidHi David,
From your description above, it seems that this issue happens occasionally. At the same time you can also use some tool to test your lightswitch application, such as:
Fiddler, it will be helpful to troubleshoot.
Best regards,
Angie
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to show/hide build in search box in javascript for LightSwitch html clients?
Hi
For each collection on content item, there is built-in showSearch button we can add, once the user clicks on the search, a pre-built-in-search-box shows up above the collection so user can search items in the list. How can I show/hide the pre-built-in-search-box
in javascript?
Any help will be appreciated
The built-in showSearch on content item
The user clicks the search button, and the pre-built-in-search-box shows up to allow user to enter search terms
jlHi Joe,
Welcome to Lightswitch forum.
If you want to show/hide showSearch button, you can execute this line to show the button,
this.FindControl("showSearch").IsVisible = true;
Or execute the line below:
this.FindControl("showSearch").IsVisible = false;
Please let me know if there is anything that I can do to help.
Best regards,
Angie
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Updating Multiple entities Programmatically in LightSwitch Html Client 2013
hi,
How to Update Multiple entities When Updating One entity in Server Side ?
Thanks in Advance...You'll probably need to give a little more information about your particular scenario but if you're doing this update server side using the updating method of your entity then you have access to do what you like with any record/entity.
If the entities are related then it may just be a case of a statement like:
YourEntity.YourRelatedEntity.SomeProperty = "Hello world.";
Or you could call a entity specifically from another table and update it accordingly:
AnotherTable ent = DataWorkspace.ApplicationData.AnotherTable.Where(r => r.id == 5).FirstOrDefault();
if (ent != null)
ent.Description = "Hello World.";
Hope that helps you.
Paul. -
LIGHTSWITCH HTML ENTITY SOFT DELETION
Hello all,
I am working on LightSwitch HTML client application. I have an issue regarding entity soft deletion.
For your kind information, I have also referred Beth Messi's link:
http://blogs.msdn.com/b/bethmassi/archive/2011/11/18/using-the-save-and-query-pipeline-to-archive-deleted-records.aspx
My Scenario:
I have an Accounts table which is related to other tables.
In Accounts edit screen, I have a delete button. On deleting account from edit screen Account should be marked as deleted in database(i.e. soft delete) if it has no reference in any other table, otherwise show client side an error message
myapp.EditAccount.DeleteAccount_Tap_execute = function (screen) {
// Write code here.
screen.Account.deleteEntity();
myapp.applyChanges().then(function success() {
// Delete successful message.
}, function error(e) {
// Delete failure message.
According to Beth Messi's example: On deletion, the entity will discard changes and mark the entity as soft deleted.
So, If data is discarded then I do not get the server side exception " Could not delete. entity is in use." and my code inside function error() could not execute.
Any different way to accomplish this is also appreciated.
Thanks,
Ravi PatelHI Ravi,
As Beth’s blog said, it marks records for deletion without actually deleting them from the database. It discards the changes, this reverts the deletion.
As I know, myapp.applyChanges(), calling apply will save all the changes of the current changeset. If only one changeset exists, it will save them to the database. If the current changeset is a nested scope, it will commit the changes to
the parent changeset. I don’t think you can use myapp.applyChanges()
method in this scenario.
Best regards,
Angie
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
HTML Client: How to get the content/value of a custom control?
I made two Custom Controls named, "CustomControl_1" and "CustomControl_2".
In the render function of "CustomControl_1", how to access the value of "CustomControl_2"?
For example,
myapp.BrowseOrders.CustomControl_2_render = function (element, contentItem) {
$(element).text("Some Value");
myapp.BrowseOrders.CustomControl_1_render = function (element, contentItem) {
$(element).text( Value of CustomControl_2 ? );I would recommend creating screen properties and binding the controls to those screen properties. Then you can easily get a reference to any value. See this article for an example of the process using custom controls:
Using The Clippy Agent in the Visual
Studio LightSwitch HTML Client
Unleash the Power - Get the LightSwitch 2013 HTML Client / SharePoint 2013 book
http://LightSwitchHelpWebsite.com -
Could not open HTML client page using internet explore
I am using Lookout 4.5 and I am facing problem with web client. An error occuring while down loading html client page in internet explorer
Attachments:
I_am_using_lookout_4.doc 206 KBHi Suki,
Try the troubleshooting links below to help:
http://zone.ni.com/devzone/conceptd.nsf/webmain/D5F8511921D0352586256A330059DEF9?opendocument&node=DZ52188_US
http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/c2aea878c555e5e186256b2700625b5b?OpenDocument
Be careful of you Internet Explorer security settings when using the web client. They need to allow the ActiveX object to be opened.
Good Luck!
Mike -
Runtime Error in Test Client after Transport
Hello SDNers,
I did enhancements to standard SAP component ICCMP_BP_SEARCH in developement system in client XXX of system SSS.
I wanted to test the functionality in client YYY so used SCC1 transaction to transport from client XXX to client YYY.
But when i tried to test the application, it resulted in runtime error.
I had kinda identified the problem while debugging, in the class CL_CHTMLB_CONFIG_UTILITY method CREATE_UI_ELEMENT, it is not taking my Z class references rather it still referring to starndard classes.
My Z classes are created for IMPL class, CTXT class and CN00 class.
If any one has suggestions your help would be appreciated
Thanks in advance.
Best Regards,
SrikanthSrikanth,
Is the definition of the enhancement set defined properly for your test client. This table does not transport and you have to maintain it manually in each client. The view is BSPWDV_EHSET_ASG for SM30. Client is not the first field in the table, so you have to edit this view in each client.
Take care,
Stephen
Maybe you are looking for
-
Working on a single computer with multiple users, I have set things up to allow each user to view and listen to the others' music libraries under the "Shared Library" function. Can you then connect an iPod touch and copy music from a shared library?
-
How do I restore the back up from my old iPhone 5 which is IOS 8.1.3 to my new iPhone 6 which is IOS 8? It's not coming up as an available back up restore option? Am I able to set up as a new iPhone and then update the new phone to IOS 8.1.3 and then
-
Hello, I'd like some help with this script if possible I wanted to save my open file to PNG format in the same location with the same name. I managed to do that with the scripts below. This is a script I found on the forum: #target photoshop main();
-
Problem in opening filename with space
Hi Folks, I am trying to open a file located on websphere appserver. file name has a space in between. (e.g. abc xyz.xls) I could not open the file in netscape and IE both. Has any one come across such problem?
-
UAV to run on LABVIEW ? can it ?
Hello .. We are planning to build a UAV with surveillance system and weapons system ..we are impressed by the way labview works and would like to reduce time by building it with labview... However I find some difficulties in exporting code to my proc