I've just upgraded my site to ASP.NET MVC 4 Beta to make use of the awesome new Web API functionality, and my site is working great except for one page which uses a particular EditorTemplate, each line I comment out, it says there is an object ref. error on the line above it, I have commented everything else out of this file except for the variable declaration to truly illustrate the weirdness of this problem:
Could this be a bug in the new System.Web.Razor v2.0 .dll shipped with MVC 4? Running under MVC 3 unchanged works fine. Not sure how to get around this :S
Update:
Ok after further investigation, I had one other code piece I hadn't commented out which was:
<div class="opt"><button class="plus#(Html.Raw(ViewData["id"] != null ? " " + ViewData["id"] : null))">+</button>
<button class="minus#(Html.Raw(ViewData["id"] != null ? " " + ViewData["id"] : null))">-</button></div>
It's for creating a stylized spinner button and worked fine in MVC 3, as soon as I comment this out, my page loads fine and the phantom object reference error disappears. I will dissect this culprit html further and see what the new MVC 4 Razor parser could be dying on. Anyone have any initial thoughts?
Ok it appeared that removing the Html.Raw() from the Razor snippet fixed this.
I think this is a new bug with ASP.NET MVC 4, or that Html.Raw() inside html tags are no longer valid. Hopefully an MVC 4 dev notices this post and might address it.
I have no idea why I used Html.Raw() in there so have taken it out and is all functioning fine now. :)
Related
When I try to open one of my forms in the designer, it says, "Object reference not set to an instance of an object." It does not provide a way to continue, and it does not give me any clue as to what is causing the error.
at Microsoft.VisualStudio.Design.Serialization.CodeDom.MergedCodeDomParser.System.CodeDom.Compiler.ICodeParser.Parse(TextReader stream)
at System.CodeDom.Compiler.CodeDomProvider.Parse(TextReader codeStream)
at Microsoft.VisualStudio.Shell.Design.Serialization.CodeDom.CodeDomDocDataAdapter.get_CompileUnit()
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)
The code compiles and runs perfectly. Cleaning, rebuilding, closing, reopening haven't worked. All the other forms open fine.
I don't even know what information is relevant. What recourse do I have to debug this?
This will sound silly. The form is apparently a duplicate for a work in progress and the build action was set to None. Setting it to Compile caused the designer to act as normal.
It would be nice if the designer would at least point you in the right direction. Problem solved.
This is because there is' an exception in the event "Load" of the form.
Place the code inside a "try .. catch" block to see the exception
I have a telerik rad editor. My application runs in .net 2.0 environment. The telerik version is : 2012.3.1016.35. The rad editor is not enabled on chrome only. I cannot type into it.Works fine in all other browsers. Upgrading to new telerik is not an option. Because this is an old client and changing will/may affect other styling things.
So what are my options. I posted this on telerik, but no response. If you need more information, please let me know. Thanks.
EDIT:
ON checking the console I got an error. Please find the image attached to see the error.
SOLUTION:
I got it. I had a line like below to open a rad window:
rwSC.VisibleOnPageLoad = True
This was causing the problem. Sometimes it would open fast and the control would load and I can place my cursor within the rad editor within the rad window and sometimes cannot. So I replaced that with this
Javascript.RegisterStartupScript(Me, "NewSC", "setTimeout(""$find('" & rwSC.ClientID & "').show();"", 500);", True)
And now it works. The rad editor within the radwindow is enabled and I can edit it.
Is this what you have: http://feedback.telerik.com/Project/108/Feedback/Details/125713?
If so, try the JS workaround there
I am using MVVM light and blend. For awhile everything was good. Now though when I look at my views in blend no data from the views are being bound. I have some data that is static and some that is being provided from design time data providers.
1) Everything works fine at run time
2) My VM shows in blend in the binding dialougs for fields (i.e. dialoug for binding a text field to my model.
3) I get no errors in blend.
4) I have tried commenting out all the design time provider includes (ViewModelLocator SimpleIoC) does not change anything.
5) A simple property like a static field of "Page Name" or "Applicaiton Title" no longer shows in design time.
Bottom line is all I get in design time is a blank black screen. But in run time all is good.
Any thoughts? I am sure I have something it does not like but without errors it is hard to known.
.Net 4.5, VS 2013, Blend 4
After spending some time to comment out some code I found what was happening. There was a line of code that was erroring out when run by Blend. Blend was executing a line of code that was returnig null and erroring out. As soon as I changed that line of code (commented it out or fixed it so it does not throw an error on accessing it in design mode), all the properties bind and show in Blend.
If you are seeing this pull up your ViewModel code and look at whatcode is running in the constructor. Easiest thing to do is just comment out all the code, save and then build the project in blend (this will force Blend to reload the view). See if things start showing agian.
After utterly disbelieving our client when they claimed they couldn't type full stops (periods) into the HTML Editor control of the Ajax Control Toolkit on their ASP.net site, I've now sadly been forced to accept it is the case.
When you press the . key, and the cursor is at the final position in the editor nothing is added to the HTML Editor control at all.
If there are any characters after the cursor position, the . works normally.
If you hit return to enter a newline, and press . it works once.
This only only occurs in IE 11, older versions of it are fine, as are Chrome, Firefox and Safari. We are using the September 2013 release of Ajax Control Toolkit.
Has anyone else encountered this? Any advice would be much appreciated.
After doing more googling specifically around AjaxControlToolkit and IE11, I found a number of people complaining about problems with the current version of ACT (the Sept 2013 release) and IE11.
e.g. Here, here and here
It seems the problem is with .net failing to identify IE 11 as an IE browser, causing various AjaxControlToolkit features to fail.
The workaround I'm using at present is to add the X-UA-Compatible http header to our site, to force IE11 to process the page with in IE10 mode.
<meta http-equiv="X-UA-Compatible" content="IE=10">
There is also this .net4 hotfix from Microsoft which should fix the problem completely when applied to your web server.
Hope this helps someone else.
I found a similar problem with v3.0.30930 in Chrome, I tracked it down to the DesignPanelEventHandler. Specifically when conditionally dealing with deletions in various browsers when clicking the backspace button. In certain situations the code looks for a keycode of 46 or Sys.UI.Key.backspace, however in Chrome the full-stop keycode on keypress is also 46, causing all sorts of problems and finally meaning the event is stopped and the full-stop is never entered into the panel.
I overrode the DesignPanelEventHandler functionality and added the following condition in before the deletion logic and stopping the event (around about line 503 in HTMLEditor\DesignPanelEventHandler.js). As far as my tests go this seems to work fine:
if (key != String.fromCharCode(Sys.UI.Key.backspace).toLowerCase())
break;
After installing .NET 4.5 to my web server I'm getting script errors trying to access my AbleCommerce store in Internet Explorer. I've tried setting the site to target .NET 4.0 again but it still doesn't work in IE so I'm not sure what's going on. I'm not sure if this is a Ajax Toolkit issue or something changed after installing .NET 4.5.
I CAN login using Chrome and FireFox but accessing the login page (click My Account or Login on the top right) shows a script error if you have IE's settings to show script errors.
Any help would be GREATLY appreciated.
SCRIPT5007: Object expected
login.aspx?ReturnUrl=%2fMembers%2fMyAccount.aspx, line 539 character 1
document.getElementById('ctl00_wpm_Login_ctl03_LoginValidationSummary').dispose
= function() {
Array.remove(Page_ValidationSummaries, document.getElementById('ctl00_wpm_Login_ctl03_LoginValidationSummary'));
}
(function(id) {
var e = document.getElementById(id);
if (e) {
e.dispose = function() {
Array.remove(Page_ValidationSummaries, document.getElementById(id));
}
e = null;
} })('ctl00_wpm_Login_ctl04_RegisterValidationSummary');
Page_ValidationSummaries gets populated with ALL validation summaries, even for controls that are not rendered to the browser
Which means it ends up with nulls in it.
Or in this example here, you are trying to remove "null" from the array, which is the converse issue.
I had to roll back to .NET 4.0 by uninstalling 4.5 from the server (and then reinstalling 4.0) to resolve this. Could not find a solution.