当前位置:编程学习 > C#/ASP.NET >>

为何表格顶部多出一个空白行

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

<!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>
</head>
<body>
    <form id="form1" runat="server">
   <asp:scriptmanager ID="sm" runat ="server" >
      <Services>
         <asp:servicereference Path ="AjaxService.asmx" />
      </Services>
  </asp:scriptmanager>
  <table border ="0">
      <tr>
          <td>
                <asp:updatepanel id="up" runat="server" >
                      <contenttemplate>
                           <asp:gridview ID="gv" runat ="server" AutoGenerateColumns ="false"  Width ="100%">
                                  <columns>
                                        <asp:templatefield>
                                                 <itemtemplate>
                                                         <table>
                                                               <tr>
                                                                   <td>
                      作者:<a href ='mailto:<%#Eval("Email") %>'><%#Eval("Email") %></a>于[<%#Eval("Ip") %>]、[<%#Eval("CreateDate") %>]留言                                                  
                                                                   </td>
                                                               </tr>
                                                               <tr ><td colspan ="2"><hr style ="border :1px solid #006CC3; width:1000px;" /></td></tr>
                                                               <tr><td><%#Eval("Title") %></td></tr>
                                                               <tr><td><%#Eval("Message")%></td></tr>
                                                               <tr><td align ="right" ><a href ="#Message">我要留言:</a>  <a href ='reply.aspx?MessageId=<%#Eval("Id")%>' >我要回复</a>  <asp:hyperlink ID="hl" runat ="server" NavigateUrl ="#">展开</asp:hyperlink><asp:panel ID="nReply" runat ="server" />
    <ajaxToolkit:DynamicPopulateExtender id="DPE" runat ="server" TargetControlID ="nReply" ClearContentsDuringUpdate ="true" UpdatingCssClass ="PopulatePanel" ScriptPath ="AjaxService.asmx" ServiceMethod ="GetReplyByMessage" ContextKey ='<%#Eval("Id")%>' PopulateTriggerControlID ="hl"/>                                                           
                                                               </td></tr>                                                                     
                                                         </table>
                                                 </itemtemplate>
                                        </asp:templatefield>
                                  </columns>
                           </asp:gridview>
                      </contenttemplate>
                </asp:updatepanel>
          </td>
      </tr>
  </table>
    </form>
</body>
</html>





为何表格首行出现一空行
--------------------编程问答-------------------- 是header,设置一下,如:
<asp:gridview ID="gv" runat ="server" AutoGenerateColumns ="false" Width ="100%" 
 ShowHeader="False"> --------------------编程问答-------------------- LZ的看看、 --------------------编程问答-------------------- boay里面这样设置:<body style=" margin-top:0px;"> 距离上边框0 试试 --------------------编程问答-------------------- 你这明显是多了列名嘛。lz那样就可以了
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,