本来高度显示好好的,可是当我点击DataGrid里的Linkbutton后,DataGrid怎么会拉长了一截呢?
代码:  <style type="text/css">
<!--
#Layer19 {
position:absolute;
left:316px;
top:314px;
width:292px;
height:131px;
z-index:34;
}
-->
</style>
<div id="Layer19" style="left: 316px; top: 314px">
    <asp:DataGrid ID="Motion_dg" runat="server" AutoGenerateColumns="False"
        ShowHeader="False" Width="288px" GridLines="None" OnItemCommand="Motion_dg_ItemCommand" PageSize="6" Height="117px">
        <Columns>
            <asp:TemplateColumn>
                <ItemTemplate>
                    <asp:Image ID="Image1" runat="server" ImageUrl="~/image/anniu.jpg" />
                </ItemTemplate>
            </asp:TemplateColumn>
            <asp:BoundColumn DataField="id" Visible="False">
                <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Size="12px"
                    Font-Strikeout="False" Font-Underline="False" />
            </asp:BoundColumn>
            <asp:ButtonColumn CommandName="title_link" DataTextField="title">
                <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Size="12px"
                    Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Left" VerticalAlign="Middle" />
            </asp:ButtonColumn>
            <asp:BoundColumn DataField="sj">
                <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Size="12px"
                    Font-Strikeout="False" Font-Underline="False" />
            </asp:BoundColumn>
            <asp:BoundColumn DataField="table_name" Visible="False"></asp:BoundColumn>
        </Columns>
    </asp:DataGrid></div>

解决方案 »

  1.   

    我也遇到过。
    点击DataGrid里的Linkbutton后打开新的窗口,
    我用js实现就不会出现问题
      

  2.   

    我觉得是你没用好css,Linkbutton也运用一个样式吧。
      

  3.   

    给Image加上固定的高度和宽度试试看。
    我以前出现过点击链接时表格被撑大现象,后来给表格内的图片加上固定高度和宽度解决了问题。
      

  4.   

    可能是脚本的问题Linkbutton在后台是用的Response.write
    我改成了Page.ClientScript.RegisterStartupScript就行了,谢谢大家关注