当我从一个Partial视图中的dropDown上更改某些内容并单击Save按钮时,数据将从另一个Partial View页面中删除,我使用了多个数据切换选项卡,但实际的ActionLink保留了下来。我显然正在努力防止数据被擦除。
关于为什么会发生这种情况的任何想法/方向?
从“部分文档”标签中删除:
router.route('/')
// CREATE INITIAL PROFILE AND ADD EMAILS, ADDRESSES, PHONES AND BUSINESSES ONE-BY-ONE
.post(function( req, res ){
Profile.findOne({'owner_id': req.body.ownerId}, (err, profile) => {
})
var card = new Card();
card.owner_id = req.body.ownerId;
card.card_name = req.body.card_name;
card.card_subtitle = req.body.card_subtitle;
card.card_type = req.body.card_type;
card.card_color = req.body.card_color;
card.first_name.item = req.body.first_name ;
card.first_name._id = profile.first_name._id;
card.last_name.item = req.body.last_name;
card.last_name._id = profile.last_name._id;
card.company = req.body.company;
card.title = req.body.title;
card.initial.item = req.body.initial ;
card.initial._id = profile.initial._id;
card.birthday.item = req.body.birthday ;
card.birthday._id = profile.birthday._id;
card.highschool.item = req.body.highschool;
card.highschool._id = profile.highschool._id;
card.college.item = req.body.college ;
card.college._id = profile.college._id;
card.facebook.item = req.body.facebook;
card.facebook._id = profile.facebook._id;
card.linkedin.item = req.body.linkedin ;
card.linkedin._id = profile.linkedin._id;
card.linkedin_bus.item = req.body.linkedin_bus ;
card.linkedin_bus._id = profile.linkedin_bus._id;
card.twitter.item = req.body.twitter ;
card.twitter._id = profile.twitter._id;
card.google.item = req.body.google ;
card.google._id = profile.google._id;
card.pinterest.item = req.body.pinterest;
card.pinterest._id = profile.pinterest._id;
card.user_image.item = req.body.user_image;
card.user_image._id = profile.user_image._id;
card.phones = req.body.phones;
card.emails = req.body.emails;
card.addresses = req.body.addresses;
card.businesses = req.body.businesses;
card.save(function(err){
if(err)
res.send(err);
res.send({message:'Card has been added'});
});
});
视图中的保存按钮:
<td>
@Html.DropDownListFor(x => x.DocumentType, new SelectList(ViewBag.DocumentTypes, "Value", "Text"), "Select Type", new { @class = "form-control", @placeholder = "Document Type" })
</td>
从控制器保存并设置详细信息:
<button type="submit" class="btn btn-primary saveDetails" disabled>Save Task Details</button>