This question is locked. New answers and comments are not allowed.
I am having problems passing my model from my view via an Ajax call to my controller. All of the model properties that have Telerik html 'For' controls in the view do not persist in the model. The only way I can access those values in the controller is using Request["control_name"]. All other standard controls like input type=text serialize just fine. What am I doing wrong? Here is my ajax call:
Controller:
View:
Steve
function
ImportLogFile() {
$.ajax({
url:
'/Job/ImportLogFile'
,
type:
'POST'
,
data: $(
"form"
).serialize(),
success:
function
(data)
{
$(
'body'
).css(
'cursor'
,
'auto'
);
alert(
"Word Counts imported."
);
},
error:
function
(xhr, status, error) {
alert(status +
": "
+ strip(xhr.responseText).substring(0, 1000) +
"..."
);
}
});
}
Controller:
[HttpPost]
public
ActionResult ImportLogFile(tblJobTask model)
{
...
}
View:
@model viaLanguage.Jams.Data.tblJobTask
<
html
>
<
head
></
head
>
<
body
>
@using (Html.BeginForm())
{
<
label
class
=
"editorLabel"
>CAT Tool Type:</
label
>
@{ Html.Telerik().ComboBoxFor(model => model.CatToolID)
.Name("JobTask_CatToolID")
.BindTo(new SelectList((IEnumerable)ViewData["CatTools"], "CatToolID", "Description"))
.HtmlAttributes(new { style = "width:220px;" });
}
<
input
id
=
"btnImport"
type
=
"button"
onclick
=
"ImportLogFile();"
/>
}
</
body
>
</
html
>
Steve