asp.net-ajax

ASP.NET MVC AJAX with HTML.ValidationMessageFor

╄→尐↘猪︶ㄣ 提交于 2019-12-21 04:29:10
问题 I'm used to the ASP.NET Webforms easy way of doing AJAX with UpdatePanels. I understand the process is much more artisanal with MVC. In a specific case, I'm using Data Annotations to validate some form inputs. I use the HTML.ValidationMessageFor helper to show an error message. If I want to use AJAX to post this form and show this error message, what would be the process? Is it possible to keep the HTML.ValidationMessageFor and make it work with AJAX? Thank you. 回答1: This article might be

ASP.NET MVC AJAX with HTML.ValidationMessageFor

风格不统一 提交于 2019-12-21 04:29:04
问题 I'm used to the ASP.NET Webforms easy way of doing AJAX with UpdatePanels. I understand the process is much more artisanal with MVC. In a specific case, I'm using Data Annotations to validate some form inputs. I use the HTML.ValidationMessageFor helper to show an error message. If I want to use AJAX to post this form and show this error message, what would be the process? Is it possible to keep the HTML.ValidationMessageFor and make it work with AJAX? Thank you. 回答1: This article might be

Asp.net Dynamic Validators don't work in Chrome or Safari

馋奶兔 提交于 2019-12-21 02:41:11
问题 Ok, I'm dynamically creating Asp.net validation controls and inserting them into an update panel. The validation works in IE and Firefox, but not in Chrome or Safari. Here is the aspx file. Don't ask why I'm not using a button server control... <asp:ScriptManager ID="ScriptManager1" runat="server" /> <div> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Always" runat="server"> <ContentTemplate> <asp:PlaceHolder ID="PlaceHolder1"

Method 'get_EnableCdn' in type 'System.Web.UI.ScriptManager' from assembly 'System.Web.Extensions' does not have an implementation

*爱你&永不变心* 提交于 2019-12-20 15:47:52
问题 Can anyone explain a perse error like this one: "Method 'get_EnableCdn' in type 'System.Web.UI.ScriptManager' from assembly 'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation." My dev box runs Windows 7, framework 4.0 and latest Ajax tool kit. Site works locally as well as on test server (win 2003, framework 4.0 and latest Ajax tool kit), but on the production server (again Win 2003) the story is different. Ironically,

Ajax.BeginForm OnFailure invoked when ModelState is InValid

白昼怎懂夜的黑 提交于 2019-12-20 09:45:33
问题 I want to call "OnFailure" when ModelState is not valid in controller. In My LoginView @using (Ajax.BeginForm("Login", new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "Login",InsertionMode = InsertionMode.Replace, OnSuccess = "Success", OnFailure = "onError" })) { } In Controller [httpPost] public ViewResult Login(LoginModel model) { if (ModelState.IsValid) { } else { ModelState.AddModelError("login is fail") } return View("Login",model) } so i want call onSuccess Method if ModelState

ASP.NET AJAX UpdatePanel & Dynamic HTML Insertion Issue (Telerik)

走远了吗. 提交于 2019-12-20 07:49:13
问题 Ok so I have a problem. I am currently working on a project using the Telerik framework for ASP.NET AJAX, although that shouldnt matter much as I am bypassing Telerik completely (almost) for this portion of the work. I'm putting together a facebook-like chat program into our company's CRM system and, while all has gone well up to this point, I've hit a roadblock. The problem is when I try to "create a new chatbox". I'm using the asp control UpdatePanel in conjunction with a jQuery $.ajax call

Help with structure for “single-page” Ajax website

ぐ巨炮叔叔 提交于 2019-12-20 07:21:53
问题 I know about the rules and this is not really a question that can be answered, but I really need help with this. I'm making a website that have a javascript music player that cannot be interrupted every time the user changes between pages. So, the site must be a sort of single page, loading the ASPX files with AJAX. What structure should I use for this? If I use a Masterpage with the player and separated aspx files, will I be able to load these files with ajax? Any help with structure or an

how to set label text inside listview from code behind

一个人想着一个人 提交于 2019-12-20 07:08:13
问题 Actually i'm developing a web template with asp.net using c# and my connection string is: <connectionStrings> <add name="NorthwindConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\SecurityTutorials.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/> </connectionStrings> and by using below code from code behind i have connected to the data base: using (System.Data.SqlClient.SqlConnection conn = new System.Data

ASP.NET AJAX $find method failes when used in jQuery's $(document).ready() method

流过昼夜 提交于 2019-12-20 06:15:08
问题 I'm trying to find a tree using ASP.NET AJAX's client-side framework. I also use jQuery for doing any JavaScript operation after the DOM is ready. my code is like: $(function(){ var tree = $find('treeId'); }); Here, tree simply is null. But when I try to find the tree on click of one of elements, it's not null: $(function(){ $('saveButton').click(function(){ var tree = $find('treeId'); }): }); 回答1: this worked for me with Telerik controls: $telerik.$(document).ready(function () { var tree =

How can I call javascript method from my aspx.cs file

我的未来我决定 提交于 2019-12-20 05:31:30
问题 I have a javascript method which I have to call from the aspx page at the time of page load. 回答1: Javascript methods are client-side methods, so you can not call them in your server side code. But if you're looking for a way to call your method at the page load put your method call into script tag and write it in your aspx page : <body> <script language="javascript"> myMethod(); </script> </body> Or you can register your scripts from code-behind like that : protected void Page_Load(object