Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
here i want to bind another drop down on selected index changed of present dropdown using kendo control here is my code

i have binded first dropdown to database scuccessfully using kendo control scuccessfully

view:-
SQL
@(Html.Kendo().DropDownList()
  .Name("productComboBox") //The name of the combobox is mandatory. It specifies the "id" attribute of the widget.
  .DataTextField("SubjectName") //Specifies which property of the Product to be used by the combobox as a text.
  .DataValueField("ID") //Specifies which property of the Product to be used by the combobox as a value.
  .BindTo(Model)   //Pass the list of Products to the combobox.
  .SelectedIndex(0) //Select an item with index 10. Note that the indexes are zero based.
  .Events(e => e
        .Select("dropdownlist_select")
        .Change("dropdownlist_change")
    )
    )

controller:-
C#
DataClasses1DataContext db = new DataClasses1DataContext();
public ActionResult Index()
{
    ViewBag.Message = "Welcome to ASP.NET MVC!";

    return View(db.Subject1s.ToList());
}

now how to perform action on select of dropdown
i did the following thing
XML
<script type="text/javascript" language="javascript">
    function dropdownlist_select() {

    }

    function dropdownlist_change() {
        //Handle the change event
    }

pls tell me what to do on this events to bind another dropdown on the same view page
Posted
v2

1 solution

C#
public ViewResult Index()
{
    var categories = from c in db.category_master select c;
    ViewData["Categories"] = new SelectList(categories, "ID", "Name");
    return View(db.akshay_category_master.ToList());

}

HTML
// In view 

@Html.DropDownList("Categories", ViewBag.applicationList as SelectList, "Select", new { onchange = "javascript:sendParam();" })

//Javascript Function 

<script type="text/javascript">
function sendParam() {

window.location = "Category/CategoryDetails/" + jQuery("#Categories").val();

}

C#
// that Method in Controller

public ViewResult CategoryDetails(int id)
{

    var Result = from C in db.category_master
                 where C.id == id
                 select C;
    return View("CategoryDetails", Result.ToList());
  
}


[Edit member="Tadit"]
Added pre tags.
[/Edit]
 
Share this answer
 
v2
Comments
ank170989 24-Mar-14 11:59am    
here i want to bind another combobox on the same view page using selection values of the above combo box pls tell me how to use same view page for category details.means index view page pls tell me how to achieve this i am new to mvc and that too using kendo combo box control if possible

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