Thank you! Turns out that I had a case error - the model had NewsItemId, and the form had NewsItemID. Will add this to my list of things to check when things go wrong. :)
brian
The above works great now. However, I have another issue. In my previous sample, I have this in the template:
<input id="NewsItemID" name="NewsItemID" value="{{:NewsItemID}}"
class="e-field e-ejinputtext valid e-disable"
style="text-align: right; width: 116px; height: 28px"/>
without this present, an update operation fails because the NewsItemID that is passed back to the CRUD handler is 0, which gets posted as a new record (entity framework update apparently posts a new record in this situation). During an insert operation, the ID isn't present, which successfully inserts a new record. .
with the above, the update succeeds, but the insert fails due to the null being passed back from the <input>.
any suggestions on how to proceed?
brian
Hi R Brain,
We have analyzed your query. We could see that you have set is-identity property for the “NewsItemID” column. The is-identity property automatically sets the value as 0 to the columns at client side. So at every time you add it returns as 0, until you handle it at server side. So we suggest you to handle the insert operation of the particular column which you have provided the is-identity property at sever side by providing the value to the column, since by the default the value for the column will be set as 0.
Please get back to us if you need further assistance.
Regards,
Renjith Singh Rajendran.
Slight change to the issue: if i set the NewsItemID column to be visible, I see that there are non-zero values for all the records. If I edit a record, and then save it, the NewsItemID isn't passed back to the server. This results in it being 0 server-side.
It looks like the only values being passed to CRUD are those that are in the form:
It doesn't seem to matter if is-identity is set or not. with it set, it still doesn't set the ID to 0 for a new record.
the only workaround I've found is to (a) have the hidden form field for NewsItemID and set default="0" for the NewsItemID column. This fills the hidden field with 0 for a new record and inserts the record correctly, and passed the original NewsItemID back for an edited record.