asp.net-ajax

How can I send int array from ajax to c# mvc?

亡梦爱人 提交于 2019-12-22 01:33:29
问题 How can I send int array from $.ajax to c# mvc? 回答1: $.ajax({ url: <Url of the action>, type: "POST", data: JSON.stringify([1,2,3]), dataType: "json", contentType: 'application/json; charset=utf-8' }); and in the action. public ActionResult ReceiveIntArray(int[] ints) { ... } mvc should parse the json automatically. check out this question. 回答2: Try solution from this question: Set the traditional property to true before making the get call. i.e.: jQuery.ajaxSettings.traditional = true $.get(

ASP.NET / iPad Safari Cache Issue?

戏子无情 提交于 2019-12-21 21:07:58
问题 We have an ASP.NET web application which uses ASP.NET Ajax. We open it from within Safari on the iPad. It works fine. We save it to the home screen as a separate icon. We added the meta tag that makes it load in full screen, without Safari's navigation bar. It works fine. Later, we re-open it and notice it is broken. Here is a portion of the HTML that is rendered that shows what doesn't work. <a id="ctl00_Header1_btnHome" class="Button" href="javascript:__doPostBack('ctl00$Header1$btnHome',''

asp.net Refresh base page from iframe

别来无恙 提交于 2019-12-21 20:56:06
问题 I have page with other asp.net page inside iframe. And on button click inside iframe i need to refresh main page from server side. How can it? 回答1: Make use of javascript and you can easily do it call the following function on your button click <script language="javascript"> function RefreshParent() { window.parent.location.href = window.parent.location.href; } </script> From the cs code if you are opening the aspx page in the iframe Page.RegisterStartupScript("RefreshParent","<script

Refresh of GridView after UpdateMethod in UpdatePanel

蓝咒 提交于 2019-12-21 20:42:54
问题 I have setup a GridView inside an UpdatePanel. The GridView has a SELECT CommandField that is tied to Gridview1_SelectedIndexChanged method. I would like the GridView to refresh after a row is selected but it never does. I have tried several different scenarios and none seem to work. I have set UpdateMode to "Conditional" and "Always" on the UpdatePanel and tried to force an update to the UpdatePanel in the code behind. I have converted the CommandField to a templatefield with a button Here

Service AJAX requests with webmethod in ASPX page

家住魔仙堡 提交于 2019-12-21 17:22:49
问题 I am trying to service AJAX requests with a method in my .aspx page. For some reason I am not getting the data returned that I want. Can anybody tell me what I am doing wrong? mypage.aspx: <%@ Page Language="VB" Title="My Page" %> <%@ Import Namespace="System.Web.Services" %> <%@ Import Namespace="System.Collections.Generic" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Protected Sub Page

How do I server AJAX calls using JSON with Web Forms?

时光总嘲笑我的痴心妄想 提交于 2019-12-21 12:25:01
问题 I know MVC controllers are quite good at serving JSON formatted AJAX requests, but is there any built-in ASP.NET functionality I can use for these type calls from a plain old web forms site? 回答1: You could use built-in ASP.NET AJAX. Option 1 - use a web service (if you want the functionality to be reusable): create a web service (.asmx) with [ScriptService] attribute, add a to your page and add the web service to its Services collection, use JavaScript proxy generated by ScriptManager in yor

Ajax.BeginForm driving me crazy

自作多情 提交于 2019-12-21 06:24:12
问题 ASP.NET MVC3 I have a partial view that is initially rendered inside a div. The following is the partial code: @model Venue.Models.Validation.CustomerRequestModel <script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> <script type="text/javascript" src="

Internet Explorer 11 gives script error in PageRequestManager.js

会有一股神秘感。 提交于 2019-12-21 05:27:09
问题 I'm using ASP.NET 4.5 on the server and I have a .NET Windows application with a Web Browser control that navigates to the web page on the server. If I run the Windows application on a system with Internet Explorer 11, I get a script error: "Object doesn't support property or method 'attachEvent'" when navigating to another page. The script file is ScriptResource.axd so it isn't any of my scripts. I do know that Internet Explorer 11 doesn't support attachEvent anymore (replaced with

Weird ASP.NET AJAX Bug / 32-bit to 64-bit

只谈情不闲聊 提交于 2019-12-21 05:25:21
问题 I'm getting a weird error from my sites ever since upgrading to Windows 2008 64-bit. I have most of my app pools running in 64-bit mode (all but one, used for a legacy ASP.NET 1.1 application). On the sites that are running on 64-bit, I've been getting errors from ASP.NET AJAX. Exception information: Exception type: System.NotSupportedException Exception message: Assembly "AjaxControlToolkit, Version=3.0.20820.16598, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" does not contain a script

Securing Ajax Requests in ASP.net via Authenticated Webforms

南楼画角 提交于 2019-12-21 05:21:11
问题 I already read Securing AJAX Requests via GUID and Securing an ajax request . Now let me explain my scenario, below would be code snippet that may aid at explaining in the subject matter. [WebMethod[EnableSession = True] [ScriptMethod] public static string CreateTitle(string strTitleName) { string strResult = "Custom jSon string"; if(Session["Authorized"] == "True" && !String.IsNullOrEmpty(strTitleName)) { String strTitle = Server.HtmlEncode(strTitleName); InsertRecordInDB(strTitle);