Making a call to ServiceStack to force a file to download.
The problem solved here is that an asp.net <button> element (html = <button runat=”server” > or <asp:HtmlButton ) doesn’t support a onclientclick event. This prevents performing client side validation ahead of the onserverclick event.
Here’s more on the problem.
Add this to within the <head>
<meta http-equiv=”X-UA-Compatible” content=”IE=edge” />
This forces IE out of compatibility mode. IE will ignore compatibility mode settings from the ‘(F12) Developer Tools’ facility.
Here’s some code that will allow testing.
Done using ‘IE Tester’ http://www.my-debugbar.com/wiki/IETester/HomePage
IE7 and IE8 will render this differently. IE8 in compatibility view mode will render it as IE7 does.
<!--meta http-equiv="X-UA-Compatible" content="IE=edge" /-->
<div style="border:1px solid green;padding:30px;">
<div style="position:relative; left:-30px">
If the red box is outside the line, it's ie8 mode<br />
If the red box is inside the line, it's ie7 mode<br />
var elementCount = $(this).data("tComboBox").dropDown.$element.find("ul").find('li').size();
I had this desperately annoying problem where I had two Combobox components. Using the .CascadeTo functionality, I was able to have the second Combobox load data via an AJAX call based on the selection in the first Combobox. This is standard functionality detailed in the demo site here.
The problem was that if the AJAX call to load the second comboxbox with data returned no elements, the Combobox remained disabled. This was unintuitive for the user and made it look like the UI had frozen.
- Add an ‘OnDataBound’ event handler to the Combobox then from this…
- …. count the number of elements in the Combobox and do something to notify the user if there are no elements
Both methods allow specific error messages to be returned to the client error handling code. This example applies to .NET c# MVC 3 with jQuery and jQuery form plugin. Before quickly scanning this blog for the solution, please note that the second solution detailed below appears to be a better option.
Continue reading “.NET MVC 3 Custom AJAX Error Handling”
There is a default limit on the file size (or total file size in the case of multiple files) of 4MB.
To increase it, add (or modify)
<httpRuntime maxRequestLength=”???” /> in Web.config
where “???” is the number of kilo bytes to permit in any upload.
Continue reading “.NET Web MVC 3 Multiple File upload limit”