3 Answers, 1 is accepted
0
Jayesh Goyani
Top achievements
Rank 2
answered on 19 Oct 2012, 06:47 AM
Hello,
Please try with below link.
http://www.kendoui.com/forums/ui/dropdownlist/dropdownlist-datasource-binding-help.aspx
Thanks,
Jayesh Goyani
Please try with below link.
http://www.kendoui.com/forums/ui/dropdownlist/dropdownlist-datasource-binding-help.aspx
$(document).ready(
function
() {
$(
'input[id="YourRadioButtonID"]'
).each(
function
() {
$(
this
).bind(
"click"
,
function
() {
// Your Ajax call code comes here
});
});
});
Thanks,
Jayesh Goyani
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 19 Oct 2012, 09:52 AM
Hello,
Another Solution.
.cshtml
Controller
Model
Thanks,
Jayesh Goyani
Another Solution.
.cshtml
<script type=
"text/javascript"
>
$(document).ready(
function
() {
$(
'input[id="CoutryID"]'
).each(
function
() {
$(
this
).bind(
"click"
,
function
() {
BindStateCombo($(
this
).val());
});
});
});
function
BindStateCombo(CoutryID) {
var
dataSource =
new
kendo.data.DataSource({
transport: {
read: {
url:
"YourDomain"
+
"VendorAccount/GetStateByCountry"
,
data: {
Value: CoutryID
}
}
}
});
var
ddl = $(
'#StateID'
).data(
"kendoDropDownList"
);
ddl.setDataSource(dataSource);
ddl.refresh();
}
</script>
<
div
>
@if (Model.Countries != null && Model.Countries.Count > 0)
{
foreach (var radioitem in Model.Countries)
{
@Html.RadioButtonFor(model => model.CoutryID, radioitem.CountryID);
@radioitem.CountryName;
<
br
/>
}
}
<
br
/>
@(Html.Kendo().DropDownListFor(model => model.StateID)
.Name("StateID")
.OptionLabel("--Select--")
.DataTextField("StateName")
.DataValueField("StateID")
)
</
div
>
Controller
public
JsonResult GetStateByCountry(
string
Value)
{
int
CountryID = 0;
if
(!
string
.IsNullOrEmpty(Value))
{
CountryID = Convert.ToInt32(Value);
}
var dataitem =
new
List<Data.Country>();
// Do your logic here
return
Json(dataitem, JsonRequestBehavior.AllowGet);
}
Model
public
class
AddCoverageArea
{
public
string
CoutryID {
get
;
set
; }
public
string
StateID {
get
;
set
; }
public
List<Country> Countries {
get
;
set
; }
}
Thanks,
Jayesh Goyani
0
Ravi
Top achievements
Rank 1
answered on 06 Nov 2012, 04:31 PM
Thanks Jayesh