Click here to Skip to main content
12,690,741 members (34,364 online)
   

ASP.NET

 
GeneralRe: ASP Buttons event not firing Pin
Blikkies5-Nov-13 22:00
memberBlikkies5-Nov-13 22:00 
QuestionNeeds help for DirectoryEntry.Invoke ("ChangePassword","Old_Pass","New_Pass") method Pin
tiyyob2-Nov-13 1:42
membertiyyob2-Nov-13 1:42 
Questionpc-phone,mobile dialer Pin
kalaiselvansurya2-Nov-13 1:14
memberkalaiselvansurya2-Nov-13 1:14 
AnswerRe: pc-phone,mobile dialer Pin
Mycroft Holmes2-Nov-13 2:10
professionalMycroft Holmes2-Nov-13 2:10 
QuestionDelegate Pin
Member 103756361-Nov-13 22:42
memberMember 103756361-Nov-13 22:42 
AnswerRe: Delegate Pin
Richard MacCutchan2-Nov-13 0:49
mvpRichard MacCutchan2-Nov-13 0:49 
AnswerRe: Delegate Pin
Bernhard Hiller4-Nov-13 4:13
professionalBernhard Hiller4-Nov-13 4:13 
QuestionMVC4 Ajax call does not reach controller method Pin
MYSHKSL1-Nov-13 11:46
memberMYSHKSL1-Nov-13 11:46 
I am new to MVC4. I am trying to issue ajax call on the button click to receive partial view with the loaded dropdown list. It looks like Ajax call never reaches controller's method GetMyList(). What is wrong with my code ? Thank you

//in mypage.cshtml
@model IEnumerable<MyProject.Models.MyModel>
@{
ViewBag.Title = "MyPage";
Layout = "~/Views/Shared/_MyLayout.cshtml";
}

<div>
....

<div>
<button id="btnGetList">Find</button>
</div>

<div id="divWithPartialView">
@Html.Partial("_MyPartialView", Model) // displayed on initial page load
</div>
...
</div>

@section MySection{

<script type="text/javascript">

$('#btnGetList').on('click', function (event) {

alert("go get list"); // shows up

var myName = "Jo";

$.ajax({
type: "POST",
url: "Main/GetMyList",
data: myName,
success: function (data) {
alert("list is here"); //does Not show up
$("#divWithPartialView").html(data);
}

});

alert("after ajax"); //shows up

})
</script>
}

// Controller

namespace MyProject.Controllers
{
public class MainController: Controller
{

............

[HttpGet]
public ActionResult MyPage()
{
List<MyModel> myList = new List<MyModel>();
return View(myList);
}

public ActionResult GetMyList(string myName)
{
MyModel mm = new MyModel();
List<MyModel> myList = mm.GetNames(myName); // using search criteria entered on the previous Application page

return PartialView("_MyPartialView", myList);

}
}
}

//Partial View: _MyPartialView.cshtml
@model IEnumerable<MyProject.Models.MyModel>

<label>Select your name:</label>
<select id="lstNames">
<option value="0">- select name -</option>
@foreach (var name in Model)
{
<option value="@name.id">@name.myName</option>
}
</select>

//Model
public class MyModel
{
public int id { get; private set; }
public string myName { get; set; }

public List<MyModel> GetNames(string myName)
{
List<MyModel> myList = new List<MyModel>();
//code to find names that start with "Jo"
return myList;
}
}
SuggestionRe: MVC4 Ajax call does not reach controller method Pin
Richard Deeming1-Nov-13 11:50
professionalRichard Deeming1-Nov-13 11:50 
AnswerRe: MVC4 Ajax call does not reach controller method Pin
Pratik Bhuva1-Nov-13 23:29
professionalPratik Bhuva1-Nov-13 23:29 
QuestionHow to rebind more three RadGrid after close the RadWindow Pin
Rahul_Pandit1-Nov-13 3:08
memberRahul_Pandit1-Nov-13 3:08 
SuggestionRe: How to rebind more three RadGrid after close the RadWindow Pin
Richard Deeming1-Nov-13 4:06
professionalRichard Deeming1-Nov-13 4:06 
QuestionReturn value of variable from Stored Procedure to BC layer Pin
Uma Sengoden31-Oct-13 9:10
memberUma Sengoden31-Oct-13 9:10 
QuestionRe: Return value of variable from Stored Procedure to BC layer Pin
Richard MacCutchan31-Oct-13 16:14
mvpRichard MacCutchan31-Oct-13 16:14 
AnswerRe: Return value of variable from Stored Procedure to BC layer Pin
Pratik Bhuva1-Nov-13 23:32
professionalPratik Bhuva1-Nov-13 23:32 
Questionwhat do you think of iron speed designer? Pin
Valery Possoz31-Oct-13 2:00
memberValery Possoz31-Oct-13 2:00 
QuestionCan you help me in this token? if(this._Item==null){ this._Item = new List<Cart>(); this._dateCreate = DateTime.Now; } }.I do not understand it and why use Pin
Danh Le29-Oct-13 19:18
memberDanh Le29-Oct-13 19:18 
AnswerRe: Can you help me in this token? if(this._Item==null){ this._Item = new List<Cart>(); this._dateCreate = DateTime.Now; } }.I do not understand it and why Pin
Joshua Omundson30-Oct-13 5:01
memberJoshua Omundson30-Oct-13 5:01 
AnswerRe: Can you help me in this token? if(this._Item==null){ this._Item = new List<Cart>(); this._dateCreate = DateTime.Now; } }.I do not understand it and why Pin
Richard MacCutchan30-Oct-13 8:03
mvpRichard MacCutchan30-Oct-13 8:03 
QuestionASP.NET GlobalResources.. Use <%$ or <%= embedded code? Pin
JD8629-Oct-13 12:59
memberJD8629-Oct-13 12:59 
AnswerRe: ASP.NET GlobalResources.. Use <%$ or <%= embedded code? Pin
Wombaticus2-Nov-13 8:43
memberWombaticus2-Nov-13 8:43 
QuestionHow To get pop up window using java script Pin
chahthuranga29-Oct-13 0:35
memberchahthuranga29-Oct-13 0:35 
AnswerRe: How To get pop up window using java script Pin
thatraja29-Oct-13 3:23
mvpthatraja29-Oct-13 3:23 
AnswerRe: How To get pop up window using java script Pin
rahul_kakadia29-Oct-13 22:06
memberrahul_kakadia29-Oct-13 22:06 
AnswerRe: How To get pop up window using java script Pin
CIKolkataDeveloper10-Nov-13 23:18
memberCIKolkataDeveloper10-Nov-13 23:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.8.170117.1 | Last Updated 17 Jan 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid