Questions tagged [asp.net-mvc-ajax]

118 questions
91
votes
15 answers

How to get an ASP.NET MVC Ajax response to redirect to new page instead of inserting view into UpdateTargetId?

I am using the Ajax.BeginForm to create a form the will do an ajax postback to a certain controller action and then if the action is successful, the user should get redirected to another page (if the action fails then a status message gets displayed…
Jeff Widmer
  • 4,666
  • 6
  • 36
  • 49
33
votes
2 answers

Why does setting UnobtrusiveJavaScriptEnabled = true prevent ajax from working?

While doing a sample using MVC3 razor, I wrote:

Show me the time in: @Ajax.ActionLink("UTC", "GetTime", new { zone = "utc" }, new AjaxOptions { UpdateTargetId = "myResults" }) @Ajax.ActionLink("BST", "GetTime", new { zone = "bst" },…

Amr Elgarhy
  • 59,046
  • 67
  • 178
  • 291
6
votes
2 answers

Is there a good explanation on what ASP.NET MVC3 is doing with its ajax helpers and rendering unobtrusive javascript?

I'm trying to look for good (in-depth) explanation on what happens when you use MVC ajax helpers. What events and css classes get added. I can find sprinkle of info here and there but no overall explanation of how this ajax framework works. Is…
dev.e.loper
  • 34,180
  • 71
  • 151
  • 237
6
votes
2 answers

Add a css class for Ajax Action link

How I can add a class for Ajax.ActionLink? @Ajax.ActionLink("Remove this photo","RemovePhoto","Admin",new{Id=Model.filename, @class="ActionClass"},new AjaxOptions{OnSuccess = "RemoveSuccess"}) but this method don't create css class for this…
SirRoland
  • 157
  • 2
  • 2
  • 10
6
votes
2 answers

asp.net mvc ajax post - redirecttoaction not working

I used the following code in one of my controller; if (Request.IsAjaxRequest()) { return RedirectToAction("PreviewAndSendEmail"); } I debugged it and it comes to return line and but redirect didn't occur. Is it…
tugberk
  • 54,046
  • 58
  • 232
  • 321
5
votes
2 answers

How to open a new popup window by clicking an html action link in MVC?

I've a view page in which there's an HTML ActionLink. Now on click of that action link, i want to open a new popup window without closing the previous one. In this new popup window i want to show my existing view page. please provide me a better…
SRV
  • 51
  • 1
  • 1
  • 2
5
votes
2 answers

using ajax with dropdownlist mvc3

Is there any way to refresh some part of page (e.g div/span) on selection of dropdownlist option ... ?? Please note I'm using razor syntax. If yes, then please give some sample code.
Milan Mendpara
  • 2,961
  • 4
  • 35
  • 56
5
votes
1 answer

The partial view 'First.cshtml' was not found or no view engine supports the searched locations

I'm trying to call partial view in div on click. I've written this: @Ajax.ActionLink("Second", "Second", new AjaxOptions() { HttpMethod = "GET", UpdateTargetId = "partials", InsertionMode = InsertionMode.Replace })
gsiradze
  • 4,055
  • 12
  • 49
  • 95
5
votes
2 answers

MVC 4 - Ajax - Replace one partial one view with another

I'm trying to replace the contents of a div in a Main view with partial views depending on which @Ajax.ActionLink is clicked. Initally I load the _CaseLoad partial view then I would like to be able to switch between the two partial views _CaseLoad…
James P
  • 2,003
  • 2
  • 17
  • 27
4
votes
1 answer

use @Ajax.ActionLink to popup a form

i want to use @Ajax.ActionLink to popup a form so i did this in my cshtml page : @Ajax.ActionLink("click ", "AddToMembers", new AjaxOptions { HttpMethod = "GET", UpdateTargetId = "result", InsertionMode = InsertionMode.Replace, OnSuccess =…
4
votes
2 answers

Ajax.BeginForm check if request was redirected

How to determine if async request form ajax form was redirected? In my case request is redirected to login page if user's session is closed. I tried to check arguments of OnComplete, OnSuccess and OnBegin events (OnFailure is not called) but no one…
Serhiy
  • 4,040
  • 4
  • 32
  • 51
4
votes
2 answers

How to call partial view through ajax in mvc3

I need to call a partial view through ajax. I have tried the following, but I am not sure how to complete it. $("#UserName").change(function () { var userid = $("#UserName").val(); var ProvincialStateID = $("#State").val(); …
MVC_Nhibernate
  • 307
  • 7
  • 22
3
votes
1 answer

get value of last appended textbox asp.net mvc

if I'll click to add date begin_date and end_date will added to my view. At start I have only 1 begin and end date. dates are added using this: $(document).ready(function () { var str = '
' + …
gsiradze
  • 4,055
  • 12
  • 49
  • 95
3
votes
0 answers

post serialise form pass null value to my controller

I am serialising my form and post it via javascript function
@model MyTable
3
votes
3 answers

MVC Post values using ajax when value selected in dropdownlist

I have several dropdownlists in a form. Each time the user selects a value in one of these dropdownlist do I want the value to be saved to the backend (database). I don't want to page to reload so I guess the best way to achive this is with ajax,…
1
2 3 4 5 6 7 8