Click here to Skip to main content
15,302,859 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have dropdown with values, whenever user selects a value from dropdown on change event it fetch data from table through EF and display in the page i.e. has input textboxes.

Thanks in advance
Posted
Comments
Pheonyx 15-Sep-14 7:32am
   
You need to explain your question a bit more clearly. Do you have an existing site that you are trying to re-produce using MVC and Razor views? Or is this a new project? You say you already have the drop downs so what exactly is your issue/error?
a.anvesh 15-Sep-14 7:45am
   
Actually My requirement is i have dropdown with values. when am selecting dropdown value i need to take id from dropdown down and am search with id in table getting the details from the table and i want to display those values in to textboxes..

Thanks
SumithF 15-Sep-14 7:46am
   
call Ajax method on dropdown onchange event.
a.anvesh 18-Sep-14 1:03am
   
Shall i call normal method or ActionResult method from Ajax request

Now am callin like this


var id = $("#Templates").val();
if (id >= 1) {
$.ajax({

Url: "/Project/Index",
data: { "id": id },
success: function (data) {
alert('Template loaded');
}

});
}

in that index method am assigning values to project model but it is not working..
please help me as well as possible...
SumithF 18-Sep-14 4:16am
   
Your client side ajax call method is correct and Controller action method should be like this.

[HttpGet]
public JsonResult GetAll()
{
List<string> model = new List<string> { "A", "B" };
return Json(model, JsonRequestBehavior.AllowGet);
}
a.anvesh 24-Sep-14 6:12am
   
how to assign a textbox value if am using above method..

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900