This question is locked. New answers and comments are not allowed.
Hi There,
I recently observed that When I populate DropDownList with List, it doen't fire Onchange event. But If I bind it with Id and value list it does fire the event.
For Ex.
List Binding
In above case, Event won't be fired.
With Id and Value Binding.
In above case, Event gets fired.
why event is not being fired when i return list??
Thanks,
Jigar.
I recently observed that When I populate DropDownList with List, it doen't fire Onchange event. But If I bind it with Id and value list it does fire the event.
For Ex.
List Binding
Dim
myList as List(Of
String
)
myList.Add(
"One"
)
myList.Add(
"Two"
)
myList.Add(
"Three"
)
Return
New
JsonResult
With
{.Data =
New
SelectList(myList)}
With Id and Value Binding.
Dim
myList
As
New
List(Of
Object
)
myList.Add(
New
With
{.id=1, .name=
"One"
})
myList.Add(
New
With
{.id=2, .name=
"Two"
})
myList.Add(
New
With
{.id=3, .name=
"Three"
})
Return
New
JsonResult
With
{.Data =
New
SelectList(myList,
"id"
,
"name"
)}
In above case, Event gets fired.
why event is not being fired when i return list??
Thanks,
Jigar.