This question is locked. New answers and comments are not allowed.
Have encountered a problem when binding a dropdownlist in MVC 2 with Teleric.Web.mvc 2011.2.712.235
And the GetPaymentTypeOptions returns a list of SelectListItem (Text, Value)
"<None>",Nothing
"Account", "PT000002"
"At Departure", "PT000003"
"Before Departure","PT000001"
"Insurance Claim","PT000004"
When I show the view with a model that contains PaymentType = Nothing then it displays the the dropdown with <None> which is correct. However when I then post back without making any changes I get the text value back in the PaymentTypeID rather than the Nothing. When changing the dropdown to Account and then back to <None> this behaviour does not occur. Can anyone tell me how to prevent this behaviour? Now I have to parse the ID against the "<None>" return value and reset it to Nothing. Have also tried the same with a list that had the empty string rather than the Nothing, but gave same erronous behaviour.
Regards,
Theo
<%= Html.Telerik.DropDownListFor(Function(b) b.PaymentTypeID) _ .BindTo(Model.GetPaymentTypeOptions) _ .HtmlAttributes(New With {.style = "width: 100%"})
And the GetPaymentTypeOptions returns a list of SelectListItem (Text, Value)
"<None>",Nothing
"Account", "PT000002"
"At Departure", "PT000003"
"Before Departure","PT000001"
"Insurance Claim","PT000004"
When I show the view with a model that contains PaymentType = Nothing then it displays the the dropdown with <None> which is correct. However when I then post back without making any changes I get the text value back in the PaymentTypeID rather than the Nothing. When changing the dropdown to Account and then back to <None> this behaviour does not occur. Can anyone tell me how to prevent this behaviour? Now I have to parse the ID against the "<None>" return value and reset it to Nothing. Have also tried the same with a list that had the empty string rather than the Nothing, but gave same erronous behaviour.
Regards,
Theo