Asp.net mvc 3 使用Asp.net Mvc3时webgrid内的自定义消息是否为空?

Asp.net mvc 3 使用Asp.net Mvc3时webgrid内的自定义消息是否为空?,asp.net-mvc-3,webgrid,Asp.net Mvc 3,Webgrid,我想在下面的else语句中的web网格中显示一条消息“找不到任何记录”。有人能帮我吗 <% var grid = new WebGrid(source: Model, defaultSort: "ProjectName", rowsPerPage: 5); using (Html.BeginForm()) { %> <div class="resourcereprtsmain"> <%:Html.Label("Project Name"

我想在下面的else语句中的web网格中显示一条消息“找不到任何记录”。有人能帮我吗

<%      
var grid = new WebGrid(source: Model, defaultSort: "ProjectName", rowsPerPage: 5);
using (Html.BeginForm())
{ %> 
    <div class="resourcereprtsmain">
    <%:Html.Label("Project Name") %>
    <%: Html.DropDownList("Projects", (SelectList)ViewBag.Projects, "--Select Project--")%>   
    <br />
    <%:Html.Label("Release Phase") %>
    <%:Html.DropDownList("ReleasePhase", "--Select ReleasePhase--")%>                                      

    <input type="submit" value="search" />                            
    </div>                                                                  
    <div id="grid">
    <%:grid.GetHtml(
     tableStyle: "listing-border_c", headerStyle: "gridhead", footerStyle: "paging", rowStyle: "td-dark", alternatingRowStyle: "td-light",                            
     columns:grid.Columns(
     grid.Column("ProjectName", "Project Name"),
     grid.Column("ReleasePhase", "ReleasePhase"),
     grid.Column("Newbugs", "New Bugs"),
     grid.Column("Assignedbugs", "Assigned Bugs"),
     grid.Column("Fixedbugs", "Fixed Bugs"),
     grid.Column("Reopenedbugs", "Reopened Bugs"),
     grid.Column("Closedbugs", "Closed Bugs"),
     grid.Column("Defferedbugs", "Deffered Bugs"),
     grid.Column("NotaBug", "Not a Bug")                           
      ))%>
    </div>                  
<%} %>


在控制器代码中 视图代码

找不到任何记录

我在控制器代码中得到了答案

视图代码

找不到任何记录


我得到了答案

“…在下面的else语句中的网格”还有什么语句?我看不到任何数据。@Mohayemin..如果GridView中没有数据,则消息显示未找到任何记录“…下面的else语句中的grid”什么else语句?我看不到任何数据。@Mohayemin..如果GridView中没有数据,则消息显示未找到任何记录
      if (ds.Tables[0].Rows.Count == 0)
            {

                TempData["notice"] = "No Records are Not Found";

            }
            else
            {

            }
<% if (TempData["notice"] != null) { %>
<p><label id="msgtext" >No Records Are Not found !!!!</label></p>
 <% } %>