I have created employee crud in which I am storing the image as well, which is working fine when we want to create new employee but in when editing the existing employee it is forcefully asking to upload the image
Loading
I have created employee crud in which I am storing the image as well, which is working fine when we want to create new employee but in when editing the existing employee it is forcefully asking to upload the image
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Asma KhalidPosted Nov 1, 2024, 8:04 AM
In edit mode, you need to fill all the mandatory fields data that are marked required or non-nullable within your ViewModel either with directly editables firlds or hidden fields. In case of image, you need hidden field hold existing image path in case user does not edit the image.
Vishal YelvePosted Oct 25, 2024, 12:09 PM
Hi Saif,
I agree with Jignesh's solution. you need to pull the image in your edit model.
Aman GuptaPosted Oct 25, 2024, 11:21 AM
Hi Saif,
I believe u had not made the Image object as Nullable=true by default it is also false, this is the reason it is asking for image when u edit employee.
If u can share the code it would be helpful
thanks
Jignesh KumarPosted Oct 25, 2024, 8:23 AM
Helli,
While edit employee you need to prefill your existing iamge to your model. Hope this will help you to troubleshoot your issue.
Vijay Pratap SinghPosted Oct 25, 2024, 7:16 AM
Hello Saif, Can you please send more details how and where you are storing your image during create new employee.
Thanks