asp.net-ajax

Asp.net mvc 4 jquery ajax request return internal server error

对着背影说爱祢 提交于 2019-12-13 17:01:52
问题 I tried to establish ajax request to asp.net mvc controller , but it give me internal server error // My Products Controller [HttpPost] public ActionResult FilterCategeory(int prodID) { var categs = new Categ() {PROD_ID=prodID }.Search(); return Json(categs); } //My ajax request $("#categs").empty(); var prm = $("#prods").val(); $.ajax({ type: "POST", url: '@Url.Action("FilterCategeory", "Products")', contentType: "application/json; charset=utf-8", data: {prodID: prm }, dataType: "json",

pass client side javascript value to server side C#

二次信任 提交于 2019-12-13 16:16:32
问题 I'm trying to pass the value of a variable created in java script in to the server side. I'm using asp.net AJAX C#. I was able to insert the value into an asp:Label by using: document.getelementbyid("MyLabel").innerhtml = "data"; but once i try to get the value in the server side: string NewLabel = MyLabel.Text; it shows a null error. does anyone know a way to pass the java script value to the server? Thank you. 回答1: You should use another control to send the value on each post, for example:

Request.UrlReferrer returning null with IE 8

好久不见. 提交于 2019-12-13 16:13:20
问题 I'm trying to access the URL in Request.UrlReferrer . It works fine in Firefox and returns me the correct value. But, when I try and access it when debugging from Internet Explorer, it returns null. My code: if (Request.UrlReferrer != null) { if (Request.UrlReferrer.ToString().IndexOf("AspxPage.aspx") > -1) { // ------ } } Why is this happening? 来源: https://stackoverflow.com/questions/6307527/request-urlreferrer-returning-null-with-ie-8

Ajax get object from controller to view

安稳与你 提交于 2019-12-13 15:23:49
问题 model : public int Id { get; set; } public string Name { get; set; } public string Adres { get; set; } public string Surname { get; set; } controller: [HttpGet] public Student GetStudentById(int id) { var output = RepositoryFactory.Create<IStudentRepository>().GetByID(id); return output; } JS: .click(function () { $.ajax({ type: "GET", url: '/Admin/GetStudentById/', data: { id: object_id }, success: function (response) { $('#toolbox-text').val(response) } }) And the problem is that i want to

Why Ajax.BeginForm does not pass form values?

China☆狼群 提交于 2019-12-13 14:37:33
问题 I'm trying to show a partial view via calling Ajax.BeginForm, but I can't receive the values of my form(I need to get the value of hidden input, bookId, in controller, e.g 5). // View @using (Ajax.BeginForm("Detail", "Books", new AjaxOptions { HttpMethod = "GET", UpdateTargetId = "ShowBookDiv" })) { <input type="hidden" id="bookId" value="5" /> <input type="submit" id="sBtn" value="Details" /> } // Controller [HttpGet] public ActionResult Detail(string bookId) { if (Request.IsAjaxRequest()) {

Sys.WebForms.PageRequestManagerServerErrorException error on IE8

一个人想着一个人 提交于 2019-12-13 14:28:34
问题 I have 2 .aspx pages. 1. Reporter.aspx 2. Report.aspx Inside Reporter.aspx I have an IFRAME and Report.aspx is kept inside the IFRAME after submitting Report.aspx to server (to load report), I want to do another thing like showing some progress or something like that. My pages looks like the following Reporter.aspx: .................... <body style="margin:2px;"> <form id="Form1" runat="server"> <dx:ASPxPopupControl ClientInstanceName="LoadingPanel" ID="LoadingPanel" HeaderText="Progress"

Passing variable to Ajax.ActionLink OnSuccess, OnComplete, OnFailure, etc

青春壹個敷衍的年華 提交于 2019-12-13 14:21:29
问题 I'd like to put a div on my master page that I can update from anywhere in my site with updates. i.e. "recorded updated", "there was an error", etc. I'm going to style the div differently depending on the type of update. "fail", "success", "info". Basic stuff so far. So I have several ActionLinks throughout the site and they display their content fine in the updateTarget and I can even have them run fine when I pass OnComplete, OnBegin, etc. functions to them. However, I'd like to be able to

ASP.NET AJAX Function.createDelegate vs Function.createCallback?

 ̄綄美尐妖づ 提交于 2019-12-13 14:13:49
问题 i'm reading the book manning - asp.net ajax in action. on page 54-58 client delegates and callbacks are described. in short: with the client delegate you can change the this variable in the event handler itself to reflect another object. (so it won't be the DOM object that triggered the event for DOM events) with a callback you can pass a context object to your event handler that will be available in the event handler as the second argument/parameter . with both you can "pass" an object to

Equivalent of ASP.Net Ajax Function.createDelegate in jQuery

孤者浪人 提交于 2019-12-13 13:44:28
问题 I was trying to port over a ASP.Net ajax behavior into a jQuery plugin. A piece of puzzle that remains solving is to find a substitute for Function.createDelegate in jQuery. I need something like this in jQuery: this.$delegateOnClick = Function.createDelegate(this, this.fireOnClick); Is jQuery .delegate method the way to go? Or is it this post: Controlling the value of 'this' in a jQuery event 回答1: I think you want the jQuery $.proxy() function. There are two forms: var proxy = $.proxy

ajax basics for beginners [closed]

[亡魂溺海] 提交于 2019-12-13 08:36:34
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . $.ajax({ type: "GET", data: "id="+id+"&id-other="+id-other, url: "ajax1.php" }).done(function(data){ $("#div").html(data); }); I have the code piece above, I search the web but I don't know how to explain what it