Telerik Forums
Kendo UI for jQuery Forum
0 answers
109 views
Hi ,

i have 3 dropdownlists on my page
-Customer
-Region
-FacilityGroup

<li>
                    <label class="fieldName"  for="CustomerName"> Customer<span class="red">*</span>:</label>
                    <span class="fieldValue">
                        @(Html.Kendo().DropDownList()
                        .OptionLabel("Select ")
                        .Name("Customer")
                        .DataTextField("CustomerName")
                        .DataValueField("CustomerId")
 
                        .Value("CustomerId")
                        .DataSource(source =>
                        {
                            source.Read(read =>
                            {
                                read.Action("GetCustomer", "AddFacility");                                  
                                 
                            });
 
                        })
                    .Events(e => e.Change("dropdownlist_Validation"))
                     
 
                        )
                        @Html.HiddenFor(m=>m.CustomerName)
                        <div id="divcustomer" >
                        @Html.Label("Required", new { @class = "red" });
                        </div>
                        <script type="text/javascript">
 
                            function GetId() {
                                return {
                                    Customer: $("#Customer").val()
                                };
                            }
                        </script>
                      @*  @Html.ValidationMessageFor(model => model.CustomerName)*@
                    </span>
                     
                    </li>
                    <li>
                  <label class="fieldName"  for="RegionName">Region<span class="red"></span>:</label>
                  <span class="fieldValue">
                  @(Html.Kendo().DropDownList()
                                .OptionLabel("Select ")
                                .Name("Region")
                                .DataTextField("RegionName")
                                .DataValueField("RegionId")
                                                                 
                                //.Value("RegionId")
                                .DataSource(source =>
                                {
                                    source.Read(read =>
                                    {
                                        read.Action("GetRegion", "AddFacility")
                                             
                                             
                                            .Data("filterRegion");
                                         
                                    })
                                     .ServerFiltering(true);
                                })
                       .Enable(false)
                       .AutoBind(false)
                       .CascadeFrom("Customer")
                       .Events(e => e.Change("dropdownlist_Validation"))
 
                                )
 
                                
                                 
                                <script type="text/javascript">
                                    function filterRegion() {
                                        return {
                                            Customer: $("#Customer").val()
                                             
                                        };
                                    }
                               </script>
                                <script type="text/javascript">
                                    function GetId() {
                                        return {
                                            Region: $("#Region").val()
                                        };
                                    }
                        </script>
                        
                  </span>
                  </li>
                    <li>
                    <label class="fieldName"  for="FacilityGroupName">Facility Group<span class="red">*</span>:</label>
                    <span class="fieldValue">
                                 @(Html.Kendo().DropDownList()
                                .OptionLabel("Select ")
                                .Name("FacilityGroup")
                                .DataTextField("FacilityGroupName")
                                .DataValueField("FacilityGroupId")
                                .Value("FacilityGroupId")
                                 
                                .DataSource(source =>
                                {
                                    source.Read(read =>
                                    {
                                        read.Action("GetFacilityGroupName", "AddFacility")
                                        //.Data("filterfacilitygroup")
                                        .Data("filterfacilitygroup2");                                       
                                    })
                                    .ServerFiltering(true);
 
                                })
        .Enable(false)
         .AutoBind(false)
                .CascadeFrom("Region")               
                .CascadeFrom("Customer")
                .Events(e => e.Change("dropdownlist_Validation"))
 
                                )<div id="divfacilitygroupname">
                                 @Html.Label("Required", new { @class = "red" });
                                </div>
                                @*<script type="text/javascript">
                                    function filterfacilitygroup() {
                                        return {
 
                                            Region: $("#Region").val()
                                             
                                        };
                                    }
                                            </script>*@
                                            <script type="text/javascript">
                                                function filterfacilitygroup2() {
                                                    return {
                                                        Customer: $("#Customer").val(),
                                                        Region: $("#Region").val()
                                                    };
                                                }
                                             </script>
                         <script type="text/javascript">
                             function GetId() {
                                 return {
                                     FacilityGroup: $("#FacilityGroup").val()
                                 };
                             }
                         </script>
                          
                    </span>
                </li>


Now as you can see i am cascading the Region and the Facility Group dropdown from the Customer dropdown .
my controller looks like dis :-
public JsonResult GetCustomer()
      {
 
          var objCustomerName = CustomerNameTypeClient.GetCustomers().Select(CustomerT => new RegionModel
          {
              CustomerId = CustomerT.CustomerId,
              CustomerName = CustomerT.CustomerName
          });
          return Json(objCustomerName, JsonRequestBehavior.AllowGet);
      }
 
      /// <summary>
      /// Gets the region.
      /// </summary>
      /// <returns>Json</returns>
      public JsonResult GetRegion(string Customer)
      {
           
 
          var VarRegionName = FacilityClient.GetRegion(Customer);
 
          return Json(VarRegionName, JsonRequestBehavior.AllowGet);
      }
 
      /// <summary>
      /// Gets the name of the facility.
      /// </summary>
      /// <returns>Json</returns>
      public JsonResult GetFacilityGroupName(string Region, string Customer)
      {
 
 
 
          var VarFacilityGroupName = FacilityClient.GetFacilityGroup(Region, Customer);
 
              
           
 
          return Json(VarFacilityGroupName, JsonRequestBehavior.AllowGet);
           
      }

Now i need to drill down the facilitygroup dropdown further using  the selection in  region dropdownlist.

Help!!!!
sarat
Top achievements
Rank 1
 asked on 24 Sep 2012
0 answers
101 views
Here is my dropdown:

@(Html.Kendo().DropDownList()
        .Name(ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty))
        .DataValueField("TaxImpsnId")
        .DataTextField("TaxImpsnName")
        .DataSource(source =>
        {
            source.Read(read =>
            {
                read.Action("_AjaxMethod", "MyController", new { lookupId= 1 });
            }).ServerFiltering(true);
        })
)

My dropdown is actually a column in a Kendo grid.  Instead of hard coding the lookupId =1 that is passed into the Ajax method in the controller, I want to take it from another field on the grid of the currently selected row.

So when the user changes the row of the grid, the drop down should reload passing in the lookupId of the currently selected grid row to the controller.

Thanks for the help.

carlg
Top achievements
Rank 1
 asked on 20 Sep 2012
0 answers
311 views

::Edited :: Solved by changing  Inherits="System.Web.Mvc.ViewPage<MVC3TelerikDemo.Models.Department>"

To

Inherits="System.Web.Mvc.ViewPage<IEnumerable<MVC3TelerikDemo.Models.Department>>"

Hi,

I am new with Telerik and trying to bind Linq.Table to the Kendo Dropdown. Following is the code.

-------Action Method---------

public ActionResult DropDownList()
{
DepartmentsDataContext context = new DepartmentsDataContext();
return View(context.Departments);

--------View Page--------

<%: Html.Kendo().DropDownList()
.Name("ddlDept")
.DataTextField("Name")
.DataValueField("DepartmentID")
.BindTo(Model)
.SelectedIndex(0)
%>

I get the following error:  CS1502: The best overloaded method match for 'Kendo.Mvc.UI.Fluent.DropDownListBuilder.BindTo(System.Collections.Generic.IEnumerable<Kendo.Mvc.UI.DropDownListItem>)' has some invalid arguments

Thank you.

Yeou

Yeou
Top achievements
Rank 1
 asked on 11 Sep 2012
0 answers
95 views
Hi,

  I want to impliment the multiselect dropdownlist   and bind the multiple values to data base.Is it possible to impliment multiselect dropdownlist in listview .How can I impliment multiselect dropdownlist in listview.
srinivas
Top achievements
Rank 1
 asked on 05 Sep 2012
0 answers
104 views
Hi all

I have created 3 dropdownlist in my page and I have 3 functions that get the data from a webservice and store it in a datasource. The second function is called on the change event of the first function, and the third function is called on the change event of the second function. My code worked well on browser, but when I ported to android through phonegap, when I go to any page that has dropdown list as soon as the page is loaded, it brings up an empty selection (as if someone selected a dropdown list that is empty), but the data is actually being placed in all 3 drop down lists. So when I touch away from that selection, everything works fine. But how can I prevent it from displaying that empty selection ? 
Pourya
Top achievements
Rank 1
 asked on 04 Sep 2012
0 answers
33 views
 Sorry wrong
Igor
Top achievements
Rank 1
 asked on 29 Aug 2012
0 answers
76 views
When I preselect an item on the DropDownList using .search() method, the change event seems not to fire up after selecting first position. How can I fix that? 
Mikolaj
Top achievements
Rank 1
 asked on 28 Aug 2012
0 answers
130 views

Code:

$("#DropDownList1").change(function () {
   custCode
= $("#DropDownList1").val();

   $
("#titles").data("kendoDropDownList").dataSource.read(); //shows list Loading But Same Data Is present .
   $
("#titles").data("kendoDropDownList").refresh(); //NOT Working

});

I am Tring to refresh my DropDownList after another DropDownList ..
is clicked but the refresh Method is not define error pops.
therefor i use the dataSource.read() then the DropDownList Shows it loading but data remain the same
Chanaka
Top achievements
Rank 2
 asked on 26 Aug 2012
0 answers
104 views
Hello,

I have an Editor Template in which only a DropDownList is present. I am trying to populate that DropDownList using an action on my controller. I have the following code:

@(Html.Kendo().DropDownListFor(m => m)
                .DataSource(
                    datasource => datasource
                        .Read(r => r.Action("GetPossibleLines", "ProductionProgram"))
                        .ServerFiltering(true)
                    )
                .DataTextField("Text")
                .DataValueField("Value")
                .HtmlAttributes(new { style = "width: 200px" }))

My action looks like this:

[HttpPost]
public ActionResult GetPossibleLines()
{
    var options =
        new List<SelectListItem>()
        {
            new SelectListItem() { Text = "LI50", Value = "51" }
        };
 
    return Json(options);
}

What am I doing wrong? The DropDownList doesn't get filled and keeps loading forever.
Max
Top achievements
Rank 1
 asked on 07 Aug 2012
0 answers
71 views
Hi,

I am using Telerik ASP.NET MVC dropdown list. I would like to display this dropdown list as Label with the selected value set to the label based on some role based authorization scenario.

1. How would I extend/implement custom render method for Telerik ASP.NET MVC dropdown list.

2. Also If I would like to add additional properties to the telerik dropdown list by extending it. How would I achieve this.

Your time and help is highly apprciated.

Thanks,
tnr
Tnr
Top achievements
Rank 1
 asked on 31 Jul 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?