Hi @Anjali Agarwal
if @ViewBag.Message message has something in it then, I want to hide the "idHide" div tag and show the "IDShow" div tag. and if the @ViewBag.Message is blank then I want to show the idHide section and hide the "IDShow" tag.
You can add an if-else
statement in the view page to check ViewBag.Message value, then based on the result to show the related section. Code in the view page like this:
@if (ViewBag.Message != null && !string.IsNullOrEmpty(ViewBag.Message))
{
<div id="IDShow">
<h4>@ViewBag.Message</h4>
</div>
}
else
{
<div class="row" id="idHide">
<h2>Edit Form</h2>
</div>
}
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion