I am working with an old web application originally developed in VB.NET 1.1. The application is now converted to the 4.0 framework and I wanted to use AJAX and the UpdatePanel. However I cannot get the UpdatePanel to work as expected. The page still does a full postback and not a partial postback as I would like it to do. If I do the same in a new application (not one converted from 1.1) it all works fine. I cannot find anything different between the two pages in terms of code and codebehind or references, obviously I am missing something. In the generated HTML for the two pages I do find differences, the page in the converted application for example does not have the following:
<script type="text/javascript">
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('ScriptManager1', 'form1',['tUpdatePanel1','UpdatePanel1'], [], [], 90, '');
//]]>
Does anyone know what I am missing?
I had the same problem and resolved comparing the web.config of the two web application. One thing making update panels not to work, was the xhtmlConformanceMode setting. You can't use Legacy mode.
Though this is not your answer, but a very strong recommendation (a friendly advice):
Avoid UpdatePanels, please!
find another way to bring your application to AJAX.
Be sure that you will pay the cost at last (my experience), so pay it now.
Related
Sorry if this is a stupid question or has been asked before, but I've been looking for an hour and haven't found any answers.
I'm working on a .NET Core MVC web application, and one of the views has subsections that I want to be able to go to directly, without having to have already loaded the view.
If the view is loaded, then href="viewname.html#sectionID" works, but it won't work if I am currently on another view. It also confuses me that my view files are .cshtml, and not plain HTML files, and it still recognizes which section of the view it needs to go to...
I tried using the Anchor Tag Helper and I couldn't figure out how I would do it with that.
Any help is greatly appreciated.
I got it to work the way I wanted it by mix and matching href="ViewName#sectionID" for when I want to go to a specific section in the view, using href only calls for all views except the homepage one and asp-action="ViewName" for the homepage view(index). Also, I defined the routes for the controller actions for every action other than the homepage. This way, the URL is basically always myURL.com/ViewName/, and on the homepage it's just myURL.com/, so an href that specifies the URL will lead to the desired controller action.
This is pretty basic, and it was just my lack of understanding towards how routing worked, but maybe someone else runs into this and finds this answer useful... I do feel pretty dumb though.
I'm upgrading from .NET 2.0 to MVC 4. Back in .NET 2.0 webform, we had to inject license information on the fly to the footer of the software by override the "Render" function in .aspx.cs page (using HtmlTextWriter), find a particular spot of the footer and then insert the license text info there.
The reason I don't want to directly put that in the viewstart page or any razor page themselves using HTMLhelper is because I don't want my customers to mess with it. So hard code is not an option.
I use Glimpse and I see Glimpse is enabled by adding a HTTPModule,etc in web.config and magically, an icon appears on my app. Something similar ?
Bottom line is, I need to hijack the finished HTML output, modify it and return the final result to client.
How do you do this in MVC? HttpModule?
Thanks!
Glimpse uses a feature of ASP.NET called a ResponseFilter to change the output HTML on the fly.
The ResponseFilter, in the case of Glimpse, is set inside the HttpModule - but it could be set anywhere.
Four Guys From Rolla has an old but still relevant article on how to create ResonseFilters.
I have tried asking this question in a number of ways, and I still can't get an answer. In Asp.net MVC4, is there a way I can just add jquery code to my views and not have to add any kind of annotation to a model to validate my form input? I just realized that I am using Ajax.BeginForm... I am betting that I cannot using regular Jquery Ajax calls with that on my form. I bet if I use HTML.beginForm, regular jquery will work. But now that will break my ajax calls... Which were failing for some reason. Well, I am about to find out why. Hopefully I can figure out how to just avoid using all Asp.net Ajax crap. It has given me nothing but a massive headache. Oh wait, you know what, I just looked at another view, and there I am using Html.BeginForm and I still can't use plain jquery code in my views to validate my form. Is this even possible in MVC4?
of course this is possible - ASP.NET MVC just emits HTML yes? so just add some jquery validate code to the document ready.
$(function(){
$('#myform').validate(/* options here */);
});
I want to modify the appearance of the login page. I've added some jquery and javascript to DesktopModules/AuthenticationServices/DNN/Login.ascx so i could have a virtual keyboard which the user can use to type the username and password. The problem is that when the login fails, it seems to me that the jquery and the javascript scripts are not executed and consequently the virtual keyboard does not appear.
I've done a lot of search on this one. I'm considering making a new login module, but i'm not sure how or if this will enable me to solve the problem.
Any suggestions out there?
DNN Version: 6.1.3
I would advise against changing the core login directly, because it's considered a "core change" and would be overwritten in an upgrade. It would require that you merge your changes before upgrading every time.
Instead, if you require that level of access, I'd suggest creating your own login module.
In looking at your problem though, I don't think that's necessary. You could achieve this same effect by creating and implementing a skin widget. Skin widgets will allow you to manipulate the UI in nearly any way you can think of since you can use jQuery and inject jQuery plugins.
This is a much more elegant solution that can scale, is testable, safe against upgrades, and allows you to reuse it as needed across multiple sites and installations.
Examples of widgets and documentation can be found in the following two links:
DNN Widget Suite Project
Skin Widget Wiki Article with many linked resources
Like Will said you definitely should not edit or add code to the core files as they will get overwritten in DNN upgrades. You should be able to solve this with just Javascript, but you could also look at a 3rd party login module like this one: http://www.dnnspot.com/Modules/DotNetNuke-Custom-Login
Has features to customize the sign in view, logged in view, even error messages. So you should be able to inject different javascript as needed in different situations.
Disclaimer - I am affiliated with DNNspot.
I used this javascript On-Screen-Keyboard (OSK) which is lovely.
(http://www.greywyvern.com/code/javascript/keyboard)
I am using DNN 5.6.8 so I'm not sure if my solution works for DNN 6.x .
I modify the "page.ascx" file of the "skin" I'm using, but I think you can modify the "page.ascx" of the default skin as well.
At the top of the page.ascx, below the list of "Register"'s I wrote this:
<script type="text/javascript" src="/js/keyboard.js" charset="UTF-8"></script>
<link rel="stylesheet" type="text/css" href="/js/keyboard.css">
Those 2 files (keyboard.js and keyboard.css) are the on-screen-keyboard. You may store them in other folders than "/js" of course.
At the bottom of the page.ascx, I put this script:
<script type="text/javascript">
$(document).ready(function () {
if (document.getElementById('dnn_ctr_Login_Login_DNN_txtUsername') != null) {
$("#dnn_ctr_Login_Login_DNN_txtUsername").attr("lang", "es");
$("#dnn_ctr_Login_Login_DNN_txtPassword").attr("lang", "es");
VKI_attach(document.getElementById('dnn_ctr_Login_Login_DNN_txtUsername'));
VKI_attach(document.getElementById('dnn_ctr_Login_Login_DNN_txtPassword'));
}
});
</script>
These names: 'dnn_ctr_Login_Login_DNN_txtUsername' and 'dnn_ctr_Login_Login_DNN_txtPassword' were the ones I saw by right-clicking and "View source code" of my DNN site running, and I think there's no reason to think they can be different in other DNN sites, but nevertheless you can check yours.
Obviously you must have jQuery active in your DNN installation. :)
That's it. It works great!!
HTH!
I am making a silverlight interface for a discussion board. The boards web interface allows the usual HTML tags like i,a,img,b,u. So now I need to be able to display that in Silverlight.
This: http://www.vectorlight.net/silverlight/controls/rich_textblock.aspx seemed like exactly what I need except that it hardly displays anything right. Every HTML(i've made sure it's valid with HTMLAgility) string I give it either makes the whole SL app go white, or the block displays all the text on top of each other. Occasionally(with a few VERY simply strings), it will display right.
This needs to work OOB and in, and I cannot use the WebBrowser control as I would need hundreds of instances at a time and it gets slow(tried it OOB).
Thanks.
Have you tried this one?
http://www.sharpgis.net/post/2010/09/15/Displaying-HTML-in-Silverlight.aspx
Maybe it can serve your needs better.
Some others
http://www.isosoft.org/taoffi/post/Html-Content-Viewer-for-Silverlight.aspx
http://blog.gfader.com/2010/05/silverlight-showing-html-content-inside.html
http://www.divelements.co.uk/silverlight/tools.aspx
Component one and Telerik both have silverlight html controls at a cost.
http://www.telerik.com/products/silverlight/htmlplaceholder.aspx
http://www.componentone.com/SuperProducts/HtmlHostSilverlight/