Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jul 03, 2011 10:31 PM by MadhuriM
Jul 03, 2011 02:56 PM|LINK
I created field in database and Entity data model. Manually I
can input them in Create.cshtml View:
<div class="editor-field"> @Html.EditorFor(model => model.InvoiceNumber, ) @Html.ValidationMessageFor(model => model.InvoiceNumber) </div>
I wish that user don't have to worry about next invoice number. What should I change and where? I suppose that in controller
Create method I need to count number of rows and send to View.
I know that is a rocky question, but I can't find anything about ui adjustment in MVC 3 applications.
Jul 03, 2011 03:57 PM|LINK
I wish that user don't have to worry about next invoice number
Let the database figure it. Make in SqlServer the field
and do not display it in the create view.
Jul 03, 2011 04:32 PM|LINK
I did, but if you delete the row, identity field keep going to add the next number. You can't use ID column for document numbering, in my opinion.
Jul 03, 2011 08:35 PM|LINK
I did, but if you delete the row, identity field keep going to add the next number. You can't use ID column for document numbering,
Oh, this is another problem. One is the PK - and another is the document numbering.
You can use either
a. add a column named "order" and populate via a trigger
b. do it the Oracle way and use a table from which you pick numbers
Jul 03, 2011 10:31 PM|LINK
Another option is write a static function with your own algorithm for creating invoice numbers and put it in the Property Setter block.
You could do something similar in the database also, write a function for creating invoice numbers and call the function as the column value.