Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
iam getting error Mobjlineitem not defined

<tbody data-bind="foreach: MobjLineitems">
                       <tr>
                           <td>
                               <input data-bind="@Html.DataBinding(m => m.MobjLineitems, it => it.MobjLineitem.productid)" type="text" value="" />
                           </td>
                           <td class="number">
                               <input data-bind="@Html.DataBinding(m => m.MobjLineitems, it => it.MobjLineitem.rate)" type="text" value="" class="number pure-input-2-3" />
                           </td>
                           <td class="number">
                               <input data-bind="@Html.DataBinding(m => m.MobjLineitems, it => it.MobjLineitem.quantity)" type="text" value="" class="number pure-input-2-3" />
                           </td>
                           <td class="number">
                               <input data-bind="value: Value" readonly="readonly" type="text" value="" class="number pure-input-2-3" />
                           </td>
                           <td>

                               <input type="button" class="pure-button" data-bind="click: $parent.delItem" value="delete"/>

                           </td>
                       </tr>
                   </tbody>


Iam using helper as below

C#
public static string DataBinding<TModel, U, V>(this HtmlHelper<TModel> helper, Expression<Func<TModel, IEnumerable>> listExpr,
          Expression<Func<U, V>> memberExpr)
        {
            var meta = ModelMetadata.FromLambdaExpression(listExpr, helper.ViewData);
            var listName = meta.PropertyName;

            string itemName = GetFullPropertyName(memberExpr);

            return string.Format("value: {1}, attr: {{ id : '{0}_' + $index() + '__{1}', name: '{0}[' + $index() + '].{1}' }}",listName, itemName);
        }




itemName is having value Mobjlineitem.productid

when its just productid there is no error

Any solution?
Posted
Updated 12-Jul-14 8:32am
v3
Comments
SumithF 15-Sep-14 8:04am    
binding through helper string method is not a good practice.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900