Click here to Skip to main content
15,899,009 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:

Hi

Please be answering me
Posted

can you understand Hindi or Gujarati...
what you wont??
you min bind dropdown list using database....ya bind gridview using dropdown list using database......i am sory my english is poor...
 
Share this answer
 
Comments
Vishal radadiya 6-Aug-14 6:48am    
i am very sorry but i can't understand your question
ckeck this link you wont like this??? yes then i will help you...
here is link i am expert in mvc entity framework, linq, jquery,angularjs....so you don't take tension ...i will help you any time...
 
Share this answer
 
v2
first you create method to get dropdwon list data in your controller like this

SQL
public ActionResult GetStudent(int id)
{
    var div = (from s in demoContext.Student_db
               where s.RollNumber == id
               select s.Div).FirstOrDefault();
    return Content(div);
}



then create view like this


@{
ViewBag.Title = "FillDropDwon";
}

C#
<pre lang="SQL"><h2>FillDropDwon</h2>
@Html.DropDownList("StudentsList", Model.Drp_Names, "Select", new {onchange="GetDiv()"})



and finally create jqurey to bind dropdwon list like this


XML
<script>
    function GetDiv() {
        var rollNumber = $('#StudentsList').val();
        $.ajax(
        {
         type: "POST",
         url: "@Url.Action("GetStudent","Home")",
         dataType: 'text',
         data: { id: rollNumber },
         success: function (result) {
             $('#myTextBox').val(result);
         },
        error: function (req, status, error) {
            alert("Coudn't load partial view"+error+req);
        }
});
}</script>





hope this is helpfully
 
Share this answer
 
v2

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