DataTable Editor, How can I add extra field on server side.
DataTable Editor, How can I add extra field on server side.
tdx369
Posts: 5Questions: 1Answers: 0
With ASP.net Mvc, How can I add extra field on server side when user create a new record.
for example,user input name,number etc and commit data to server, I want add ip,createdatetime,userid, and other field when create a new record on server side
This discussion has been closed.
Replies
you can use set formatters and fill those fields as you like. you simply define them in your editor instance and fill them accordingly.
https://editor.datatables.net/manual/net/formatters
I tried it. Like the example in staffcontroller.cs .
.Field(new Field("age")
.Validator(Validation.Numeric())
.SetFormatter(Format.IfEmpty(89))
)
.Field(new Field("salary")
.Validator(Validation.Numeric())
.SetFormatter(Format.IfEmpty(76))
)
When create a new record ,the "salary" value 76 inserted to database,but the "age" 89 value didn't inserted to database. In database table ,"age" always is null.but "salary" is good.
Why? How can I do?
So something else is wrong. Any error messages? Can you post an example, please.
The under method shall be taken! It worked, well done!
editor.Field(
new Field( "created" )
.Set( Field.SetType.Create )
.SetValue( date("yyyy-MM-dd") )
);
editor.Field(
new Field( "updated" )
.Set( Field.SetType.Edit )
.SetValue( date("yyyy-MM-dd") )
);
rf1234 ,Thank your support!