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

vs2011中GridView嵌套问题,在火狐中显示不正常

这个是不正常的

这个是正常的


想问下第一张图片为什么会那样显示 该怎么解决

前台代码:

<asp:GridView runat="server" ID="gridDict"     Font-Size="Small" 
            EmptyDataText="无数据" Width="100%"  AutoGenerateColumns="False" CellPadding="1" 
            AllowPaging="True"  BackColor="White" BorderColor="#3366CC" BorderStyle="None" 
            BorderWidth="1px" DataKeyNames="Signs" 
            onrowdatabound="gridDict_RowDataBound"
              OnPageIndexChanging="gridDictDetail_PageIndexChanging" >
        <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
        <RowStyle BackColor="White" ForeColor="#003399" />
        <EmptyDataRowStyle VerticalAlign="Top" />
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <img alt="" src="../images/plus.jpg" onclick="javascript:expandcollapse('div<%# Eval("ID") %>', 'one');"   id="imgdiv<%# Eval("ID") %>"/>
                </ItemTemplate>
                <ItemStyle Width="40px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="选择">
            <HeaderStyle Wrap="False" HorizontalAlign="Center" Width="5%" CssClass="DHBT"></HeaderStyle>
            <ItemTemplate>
            <div style="text-align:center ;">
                <input id="chkDel" value="<%# Eval("Signs") %>" type="checkbox" name="<%# Eval("Id") %>chkDel" onclick="CheckAll(<%# Eval("ID") %>,this)" />
            </div>
            </ItemTemplate>
            <ItemStyle HorizontalAlign="Center"></ItemStyle>
            </asp:TemplateField>
            <asp:BoundField DataField="Name" HeaderText="名称" />
            <asp:BoundField DataField="Signs" HeaderText="标识" />
            <asp:BoundField DataField="Remark" HeaderText="备注" />
        <asp:TemplateField >
                <ItemTemplate>
                <div id="div<%# Eval("Id") %>" style="display:none;position:relative;left:15px;OVERFLOW: auto;WIDTH:100%" >
                    <asp:GridView ID="gridDictDetail" AllowPaging="false" AllowSorting="true" BackColor="White" Width="100%" Font-Size="X-Small"
                        AutoGenerateColumns="false" Font-Names="Verdana" runat="server" ShowFooter="true"
                        GridLines="None"   BorderStyle="Double" BorderColor="#0083C1" >
                        <RowStyle BackColor="Gainsboro"  />
                        <AlternatingRowStyle BackColor="White" />
                        <HeaderStyle BackColor="#0083C1" ForeColor="White"/>
                        <FooterStyle BackColor="White" />
                        <Columns>
                            <asp:TemplateField HeaderText="选择">
                                <HeaderStyle Wrap="False" HorizontalAlign="Center" Width="5%" CssClass="DHBT"></HeaderStyle>
                                <ItemTemplate>
                                <div style="text-align:center ;">
                                    <input id="chkDel" value="<%# Eval("Signs") %>" type="checkbox" name="<%# Eval("Id") %>chkDel" onclick="GetDelIDs()" />
                                </div>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                            </asp:TemplateField>
                            <asp:BoundField DataField="Signs" HeaderText="标识" />
                            <asp:BoundField DataField="Val" HeaderText="名称" />
                            <asp:BoundField DataField="Remark" HeaderText="备注" />
                            <asp:BoundField DataField="IsValid" HeaderText="是否有效" />
                        </Columns>
                    </asp:GridView>
                </div>
                </ItemTemplate>
                <ItemStyle/>
            </asp:TemplateField>
        </Columns>
        <PagerTemplate>
            第<asp:Label id="lblPageIndex" runat="server" text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1  %>' />页 共<asp:Label id="lblPageCount" runat="server" text='<%# ((GridView)Container.Parent.Parent).PageCount  %>' />页  <asp:linkbutton id="btnFirst" runat="server" causesvalidation="False" commandargument="First" commandname="Page" text="首页" /><asp:linkbutton id="btnPrev" runat="server" causesvalidation="False" commandargument="Prev" commandname="Page" text="上一页" /><asp:linkbutton id="btnNext" runat="server" causesvalidation="False" commandargument="Next" commandname="Page" text="下一页" /><asp:linkbutton id="btnLast" runat="server" causesvalidation="False" commandargument="Last" commandname="Page" text="尾页" /><asp:textbox id="txtNewPageIndex" runat="server" width="20px" text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1  %>' /><asp:linkbutton id="btnGo" runat="server" causesvalidation="False" commandargument="-1" commandname="Page" text="GO" OnClick="Turn_Click" />
        </PagerTemplate>
        <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Right"/>
        <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
        <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
    </asp:GridView>

后台代码:

    private void BindGrid()
    {
        this.gridDict.DataSource = daldict.GetList("").Tables[0];
        this.gridDict.DataBind();
    }
    protected void gridDict_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        GridViewRow row = e.Row;
        string strSort = string.Empty;
        if (row.DataItem == null)
        {
            return;
        }
        GridView gv = new GridView();
        GridView gv4 = new GridView();
        gv = (GridView)row.FindControl("gridDictDetail");
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string datakey = this.gridDict.DataKeys[e.Row.RowIndex].Value.ToString();
            gv.DataSource = daldictdetail.GetList("Signs='" + datakey + "'").Tables[0];
            gv.DataBind();
        }
    }

--------------------编程问答-------------------- 没人吗 帮帮忙啊 --------------------编程问答-------------------- 那里不正常没看出来。 --------------------编程问答-------------------- 顶起 期待高人 --------------------编程问答-------------------- style="display:none;position:relative;left:15px;OVERFLOW: auto;WIDTH:100%"
去掉
是不是你的样式的问题啊 --------------------编程问答-------------------- 去掉不行 不是样式问题
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,