How to check if ViewBag property is null or not exists in asp.net MVC

How to check if ViewBag property is null or not exists in asp.net MVC

 

 <table id="default-datatable" class="table table-bordered">
                            <thead>
                                <tr>
                                    <th>Edit</th>
                                    <th>Title</th>
                                    <th>Publish Status</th>
                                    <th>Desc.</th>                                   
                                </tr>
                            </thead>
                            <tbody>
                                @if(ViewBag.dtArticleList !=null)
                                { 
                                foreach (System.Data.DataRow item in ViewBag.dtArticleList.Rows)
                                {
                                    <tr class="">
                                        <td>
                                            <div>
                                                <p style="text-align:match-parent; white-space:normal; max-width:300px;"><a href="/user/EditArticle?ID=@item["ID"].ToString()">EDIT</a></p>
                                            </div>
                                        </td>
                                        <td>@item["OriginalTitle"]</td>
                                        @if (@item["PublishStatus"].ToString() == "5")
                                        {
                                            <td style="color:red;">Pending</td>
                                        }
                                        else if (@item["PublishStatus"].ToString() == "0")
                                        {
                                            <td style="color:blue;">Published</td>
                                        }
                                        <td>@Html.Raw(@item["Description"])</td>
                                        
                                       
                                        @*<td>
                                            <a href="#" data-toggle="modal" data-target="#darkmodal" onclick="javascript:Edit(@item.galleryID);">Edit</a>
                                        </td>*@
                                    </tr>
                                }
                                }
                            </tbody>
                        </table>

2021-10-03