首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

GridView不显示的有关问题

2011-12-28 
GridView不显示的问题这样子的,我做了一个界面用GIRDVIEW读取数据库内容,可是每次编译的时候没错误。网页打

GridView不显示的问题
这样子的,我做了一个界面用GIRDVIEW读取数据库内容,可是每次编译的时候没错误。网页打开那个控件就没看见了。不知道怎么回事
源代码:

<%@   Page   Language= "C# "   AutoEventWireup= "true "     CodeFile= "ShowDisk.aspx.cs "   Inherits= "_Default "   %>

<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<html   xmlns= "http://www.w3.org/1999/xhtml "   >
<head   runat= "server ">
        <title> 网络硬盘 </title>
        <link   href= "BaseCss.css "   rel= "stylesheet "   type= "text/css "   />
</head>
<body   style= "vertical-align:   top;   text-align:   left ">
        <form   id= "form1 "   runat= "server ">
        <div>
                <table   border= "0 "   cellpadding= "0 "   cellspacing= "0 "   style= "width:   100% ">
                        <tr>
                                <td   style= "font-weight:   bold;   font-size:   x-large;   width:   100px;   color:   red;   font-family:   宋体 ">
                                        网络硬盘 </td>
                        </tr>
                        <tr>
                                <td   style= "width:   100px "> <hr   width= "1024px "   />
                                </td>
                        </tr>
                        <tr>
                                <td   style= "width:   100px;   height:   19px; ">
                                        <asp:Label   ID= "Label1 "   runat= "server "   Font-Size= "14px "   Text= "当前目录: "   CssClass= "Text "> </asp:Label>
                                        <asp:DropDownList   ID= "DirList "   runat= "server "   AutoPostBack= "True "   CssClass= "SelectCss "
                                                OnSelectedIndexChanged= "DirList_SelectedIndexChanged "   Width= "323px ">


                                        </asp:DropDownList>
                                        &nbsp;&nbsp;   <a   href= "AddFolder.aspx "> [新建文件夹] </a>   &nbsp;   &nbsp;   <a   href= "SearchFile.aspx "> [搜索文件] </a> </td>
                        </tr>
                        <tr>
                                <td   style= "width:   100px;   vertical-align:   bottom;   text-align:   left;   height:   31px; "> <hr   width= "1024px "   /> </td>
                        </tr>
                        <tr>
                               
                                <td   style= "width:   100px;   height:   15px; ">
                                <asp:GridView   ID= "DiskView "   runat= "server "   AutoGenerateColumns= "False "   CssClass= "GbText "
Width= "100% "   OnRowCommand= "DiskView_RowCommand "   OnRowDataBound= "DiskView_RowDataBound "   OnRowDeleting= "DiskView_RowDeleting "   DataKeyNames= "DirID ">
<FooterStyle   ForeColor= "White "   BackColor= "#990000 "   Font-Bold= "True "> </FooterStyle>
<SelectedRowStyle   Font-Bold= "True "   ForeColor= "Navy "   BackColor= "#FFCC66 "   BorderColor= "CornflowerBlue "   />
<RowStyle   ForeColor= "#333333 "   BackColor= "#FFFBD6 "   BorderColor= "CornflowerBlue "   BorderStyle= "Solid "   BorderWidth= "1px "   />
<HeaderStyle   Font-Bold= "True "   ForeColor= "#FFFFCC "   CssClass= "GbText "   BackColor= "#3B6BD1 "   HorizontalAlign= "Left "> </HeaderStyle>
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox   ID= "DirCheck "   runat= "server "   Checked= "false "   />
</ItemTemplate>
<ItemStyle   HorizontalAlign= "Center "   />
<HeaderStyle   Width= "5% "   />
</asp:TemplateField>
<asp:TemplateField   HeaderText= "目录名称 ">
<ItemStyle   HorizontalAlign= "Left "   />
<HeaderStyle   Width= "40% "   />
</asp:TemplateField>
<asp:TemplateField     HeaderText= "创建时间 ">
<ItemTemplate>


<%#   DataBinder.Eval(Container.DataItem, "CreateDate ")   %>
</ItemTemplate>
<ItemStyle   HorizontalAlign= "Center "   />
<HeaderStyle   Width= "15% "   HorizontalAlign= "Center "   />
</asp:TemplateField>
<asp:TemplateField     HeaderText= "目录/文件大小 ">
<ItemTemplate>
<%#   (int)DataBinder.Eval(Container.DataItem, "Contain ")/1024   %> KB
</ItemTemplate>
<ItemStyle   HorizontalAlign= "Center "   />
<HeaderStyle   Width= "15% "   HorizontalAlign= "Center "   />
</asp:TemplateField>
<asp:TemplateField   HeaderText= "操作 ">
<ItemTemplate>
<a   href= ' <%#(bool)DataBinder.Eval(Container.DataItem, "Flag ")   ==   true   ?   "EditFolder.aspx "   :   "EditFile.aspx "   %> ?DirID= <%#DataBinder.Eval(Container.DataItem, "DirID ")   %> '> 编辑 </a> &nbsp;&nbsp;&nbsp;
<asp:HyperLink   ID= "DownBtn "     Target= "_blank "   runat= "server "   ImageUrl= "~/Images/down.gif "   Visible= ' <%#   !(bool)DataBinder.Eval(Container.DataItem, "Flag ")   %> '   NavigateUrl= ' <%#   DataBinder.Eval(Container.DataItem, "Url ")%> '> </asp:HyperLink> &nbsp;&nbsp;&nbsp;
<asp:ImageButton   ID= "DeleteBtn "   runat= "server "   CommandName= "delete "   Visible= ' <%#   (bool)DataBinder.Eval(Container.DataItem, "Flag ")   &&   ((int)DataBinder.Eval(Container.DataItem, "DirCount ")   +   (int)DataBinder.Eval(Container.DataItem, "FileCount "))   >   0   ?   false   :   true   %> '   ImageUrl= "~/Images/delete.gif "   AlternateText= "删除该数据项 "   CommandArgument= ' <%#   DataBinder.Eval(Container.DataItem, "DirID ")   %> '   /> &nbsp;&nbsp;&nbsp;
<asp:HyperLink   ID= "HerfUpload "   Text= "上载文件 "   Target= "_blank "   runat= "server "   Visible= ' <%#(bool)DataBinder.Eval(Container.DataItem, "Flag ")   %> '   NavigateUrl= ' <%#   "UploadFile.aspx?DirID= "   +   DataBinder.Eval(Container.DataItem, "DirID ")   %> '> </asp:HyperLink>
</ItemTemplate>
<ItemStyle   HorizontalAlign= "Center "   />
<HeaderStyle   Width= "30% "   HorizontalAlign= "Center "   />
</asp:TemplateField>
</Columns>
<AlternatingRowStyle   BorderColor= "CornflowerBlue "   BackColor= "White "   BorderStyle= "Solid "   BorderWidth= "1px "   />
<PagerStyle   BackColor= "#FFCC66 "   ForeColor= "#333333 "   HorizontalAlign= "Center "   />
<EditRowStyle   BorderColor= "CornflowerBlue "   BorderWidth= "1px "   />
</asp:GridView>
                                </td>


                        </tr>
                        <tr>
                                <td   style= "width:   100px;   height:   15px; ">
                                        <asp:Button   ID= "Button1 "   runat= "server "   CssClass= "ButtonCss "   Text= "返回上级目录 "   Width= "108px "   /> </td>
                        </tr>
                        <tr>
                                <td   style= "width:   100px;   height:   16px; ">
                                </td>
                        </tr>
                        <tr>
                                <td   style= "width:   100px;   height:   22px; ">
                                        &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;
                                        &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;
                                        &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;
                                        &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;
                                        &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;   &nbsp;&nbsp;
                                        <asp:Button   ID= "Button2 "   runat= "server "   CssClass= "ButtonCss "   Text= "移动到... "   Width= "108px "   />
                                        <asp:DropDownList   ID= "DropDownList2 "   runat= "server "   CssClass= "SelectCss "   Width= "242px ">


                                        </asp:DropDownList> </td>
                        </tr>
                        <tr>
                                <td   style= "width:   100px ">
                                </td>
                        </tr>
                </table>
       
        </div>
        </form>
</body>
</html>


[解决办法]
后台有绑定吗?
[解决办法]
前台没有SqlDataSource

后台就一定要自己手工绑定数据的
[解决办法]
后台一定要绑定,要不肯定没有数据的

热点排行