resident
شنبه 26 بهمن 1392, 10:36 صبح
سلام. میشه کاری کرد که در View مقادیر فرم رو خوند و در مدل ریخت؟ بدون اینکه بریم به کنترلر؟
من کد زیر رو نوشتم ولی خطا میده .
<script type="text/javascript">
function AddCar() {
@{
CommonCar Car = new CommonCar();
Car.Car_CarTypeID =} $("#Car_CarTypeID").val()
@{Car.Title =} $('#Car_Title').val()
@{Model.Cars.Add(Car);}
}
</script>
خطاها:
Cannot implicitly convert type 'void' to 'int'
Cannot implicitly convert type 'void' to ‘string’
من کد زیر رو نوشتم ولی خطا میده .
<script type="text/javascript">
function AddCar() {
@{
CommonCar Car = new CommonCar();
Car.Car_CarTypeID =} $("#Car_CarTypeID").val()
@{Car.Title =} $('#Car_Title').val()
@{Model.Cars.Add(Car);}
}
</script>
خطاها:
Cannot implicitly convert type 'void' to 'int'
Cannot implicitly convert type 'void' to ‘string’