【问题标题】:Gridview Table not visible, html does not renderGridview 表不可见,html 不呈现
【发布时间】:2011-04-20 22:52:41
【问题描述】:

我有一个绑定到对象数据源的网格视图。它正在获取数据,数据在 html 标记中 - 我只是看不到它!

这是默认的.aspx:

记忆井信息服务

<asp:ObjectDataSource ID="resumesource" runat="server" SelectMethod="FetchAllGigs" EnablePaging="false" 
 DataObjectTypeName="memorywell_2DataModel.Resume" TypeName="memorywell_2DataModel.Resume">   
</asp:ObjectDataSource>    
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" DataSourceID="resumesource" AllowPaging="false" PageSize="10">
     <EmptyDataTemplate>
        No data for your query.</EmptyDataTemplate>
    <Columns>
     <asp:TemplateField>
            <ItemTemplate>
               Description: <%# Eval("Description") %>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
    </asp:GridView>

</form>

这是我浏览器“查看页面源代码”中的 html:

记忆井信息服务

    <div>
<table cellspacing="0" rules="all" border="1" id="GridView1" style="border-collapse:collapse;">
    <tr>
        <th scope="col">&nbsp;</th>
    </tr><tr>
        <td>
               Description: (Contract)  Maintain 4 websites including a national site that receives 80,000 hits per month.  Develop new sites and custom modules in C# and MS SQL for DotNetNuke content management system.  Developing new internationally targeted community site that includes custom C# modules for product reviews.                                                                                                                                                                                                                  
            </td>
    </tr>
</table>

</form>

【问题讨论】:

    标签: asp.net gridview


    【解决方案1】:

    根据您提供的 HTML,您应该有一个表格,其中包含一个单元格和里面的文本(请参阅jsfiddle 与您的 HTML)
    检查您的表是否在隐藏的容器(可能是某个 DIV)内。

    【讨论】:

    • 谢谢。你是对的。我只是删除了原始表单并重新创建它并且它有效。这是一些 Visual Studio 2008 错误。感谢收看。
    猜你喜欢
    • 2019-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-08
    相关资源
    最近更新 更多