嵌套网格视图的大小不合适

嵌套网格视图的大小不合适

本文介绍了嵌套网格视图的大小不合适的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有四个嵌套的网格视图当我点击+图像时,下一个网格视图将打开,但问题是在离开这样的列之后出现内部网格现在我希望内部网格也应该看起来相同而不留下左边的列和右边 - A 0 0 0 0 + B 0 0 0 0 有没有办法做到这一点 < script type = text / javascript src = http://ajax.googleapis.com/ajax/libs/jquery/ 1.8.3 / jquery.min.js > < /脚本 > < script type = text / javascript > $(function(){ $([id * = imgLevel1 ])。each(function(){ if($(this)[0] .src.indexOf(minus)!= -1){ $(this).closest( tr)。after(< tr > < td colspan =' 10' > + $(this).next()。html()+< / td > < / tr > ); $(this).next()。remove(); } }); $([id * = imgLevel2])。each(function(){ if($(this)[0] .src.indexOf(minus)!= -1){ $(this).closest(tr)。after(< tr > < > < td colspan =' 10' > + $(this).next()。html()+< / td > < / tr > ); $(this).next()。rem OVE(); } }); $([id * = imgLevel3])。each(function(){ if($(this)[0] .src.indexOf(minus)!= -1){ $(this).closest(tr)。after(< tr > < td colspan =' 10' > + $(this).next()。html ()+< / td > < / tr > ); $(this).next()。remove(); } }); }); < / script > < asp:Panel runat = server ID = pnlLevel1 BorderColor = 灰色 BorderWidth = 1px 宽度 = 100% > < table style = width:100 %;高度:100%; > < tr > < td > < asp:GridView ID = gvLevel1 runat = server AutoGenerateColumns = false PageSize = 40 宽度 = 100% 高度 = 100% DataKeyNames = LocID onrowdatabound = gvLevel1_RowDataBound > < 列 > < asp:TemplateField > < ItemTemplate > < asp:ImageButton ID = imgLevel1 runat = server OnClick = Show_Hide_Level1Grid ImageUrl = 〜/ images / plus。 png CommandArgument = 显示 / > < asp:Panel ID = pnlLevel2 runat = server 样式 = position:relative; margin-left:-5px;边框颜色:红色; border-width:1px; 宽度 = 100% > < asp:GridView ID = gvLevel2 runat = server AutoGenerateColumns = false 宽度 = 100% ShowHeader = false DataKeyNames = LocID PageSize = 40 OnRowDataBound = gvLevel2_RowDataBound 样式 = position:relative; margin-left:-5px; > < 列 > < asp:TemplateField ItemStyle-Width = 40px > < ItemTemplate > < asp:ImageButton ID = imgLevel2 runat = server O nClick = Show_Hide_Level2Grid ImageUrl = 〜/ images / plus.png CommandArgument = 显示 / > < asp:Panel ID = pnlLevel3 runat = server 样式 = position:relative; margin-left:-7px; 宽度 = 100% > < asp: GridView ID = gvLevel3 runat = server AutoGenerateColumns = false 宽度 = 100% onrowdatabound = gvLevel3_RowDataBound ShowHeader = false 样式 = position:relative; margin-left:-6px; DataKeyNames = LocID PageSize = 40 > < 列 > < asp:TemplateField ItemStyle-Width = 40px > < ItemTemplate > < asp:ImageButton ID = imgLevel3 runat = server OnClick = Show_Hide_Level3Grid ImageUrl = 〜/ images / plus.png CommandArgument = Sh ow / > < asp:Panel ID = pnlLevel4 runat = server 样式 = position:relative; margin-left:-7px; 宽度 = 100% > < asp:GridView ID = gvLevel4 runat = 服务器 AutoGenerateColumns = false PageSize=\"40\" Width=\"100%\" ShowHeader=\"false\" Style=\"position: relative;margin-left:-6px;\" onrowdatabound=\"gvLevel4_RowDataBound\" DataKeyNames=\"LocID\"> <Columns> <asp:BoundField ItemStyle-Width=\"390px\" ItemStyle-HorizontalAlign=\"Center\" DataField=\"SubName\" ItemStyle-Font-Bold=\"true\"/> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-HorizontalAlign=\"Center\" DataField=\"DraftCount\" ItemStyle-Height=\"40px\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-Height=\"40px\" ItemStyle-HorizontalAlign=\"Center\" DataField=\"SubmittedCount\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-Height=\"40px\" ItemStyle-HorizontalAlign=\"Center\" DataField=\"ApproveCount\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-Height=\"40px\" ItemStyle-Ho rizontalAlign=\"Center\" DataField=\"RejectCount\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-Height=\"40px\" ItemStyle-HorizontalAlign=\"Center\" DataField=\"EditCount\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-Height=\"40px\" ItemStyle-HorizontalAlign=\"Center\" DataField=\"LockCount\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-Height=\"40px\" ItemStyle-HorizontalAlign=\"Center\" DataField=\"PendingCount\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-Height=\"40px\" ItemStyle-HorizontalAlign=\"Center\" DataField=\"ReportCount\" /> </Columns> </asp:GridView> </asp:Panel> </ItemTemplate> </asp:TemplateField> <asp:BoundField ItemStyle-Width=\"323px\" ItemStyle-HorizontalAlign=\"Center\" DataField=\"SubName\" ItemStyle-Font-Bold=\"true\"/> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-HorizontalAlign=\"Center\" DataField=\"DraftCount\" ItemStyle-Height=\"40px\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-Height=\"40px\" ItemStyle-HorizontalAlign=\"Center\" DataField=\"SubmittedCount\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-Height=\"40px\" ItemStyle-HorizontalAlign=\"Center\" DataField=\"ApproveCount\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-Height=\"40px\" ItemStyle-HorizontalAlign=\"Center\" DataField=\"RejectCount\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-Height=\"40px\" ItemStyle-HorizontalAlign=\"Center\" DataField=\"EditCount\" /> <asp:BoundField ItemStyle-Width=\" 40px\" ItemStyle-Height=\"40px\" ItemStyle-HorizontalAlign=\"Center\" DataField=\"LockCount\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-Height=\"40px\" ItemStyle-HorizontalAlign=\"Center\" DataField=\"PendingCount\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-Height=\"40px\" ItemStyle-HorizontalAlign=\"Center\" DataField=\"ReportCount\" /> </Columns> </asp:GridView> </asp:Panel> </ItemTemplate> </asp:TemplateField> <asp:BoundField ItemStyle-Width=\"313px\" ItemStyle-HorizontalAlign=\"Center\" DataF ield=\"SubName\" ItemStyle-Font-Bold=\"true\"/> <asp:BoundField ItemStyle-Width=\"42px\" DataField=\"DraftCount\" ItemStyle-HorizontalAlign=\"Center\" ItemStyle-Height=\"40px\" /> <asp:BoundField ItemStyle-Width=\"40px\" DataField=\"SubmittedCount\" ItemStyle-HorizontalAlign=\"Center\" ItemStyle-Height=\"40px\" /> <asp:BoundField ItemStyle-Width=\"40px\" DataField=\"ApproveCount\" ItemStyle-HorizontalAlign=\"Center\" ItemStyle-Height=\"40px\" /> <asp:BoundField ItemStyle-Width=\"40px\" DataField=\"RejectCount\" ItemStyle-HorizontalAlign=\"Center\" ItemStyle-Height=\"40px\" /> <asp:BoundField ItemStyle-Width=\"40px\" DataField=\"EditCount\" ItemStyle-HorizontalAlign=\"Center\" ItemStyle-Height=\"40px\" /> <asp:BoundField ItemStyle-Width=\"40px\" DataField=\"LockCount\" ItemStyle-HorizontalAlign=\"Center\" ItemStyle-Height=\"40px\" /> <asp:BoundField ItemStyle-Width=\"40px\" DataField=\"PendingCount\" ItemStyle-HorizontalAlign=\"Center\" ItemStyle-Height=\"40px\" /> <asp:BoundField ItemStyle-Width=\"40px\" DataField=\"ReportCount\" ItemStyle-HorizontalAlign=\"Center\" ItemStyle-Height=\"40px\" /> </Columns> </asp:GridView> </asp:Panel> </ItemTemplate> </asp:TemplateField> <asp:BoundField ItemStyle-Width=\"300px\" ItemStyle-HorizontalAlign=\"Center\" ItemStyle-Height=\"40px\" DataField=\"SubName\" HeaderText=\"Location Name\" ItemStyle-Font-Bold=\"true\"/> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-HorizontalAlign=\"Center\" ItemStyle-Height=\"40px\" DataField=\"DraftCount\" HeaderImageUrl=\"~/images/actions/draft.png\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-HorizontalAlign=\"Center\" ItemStyle-Height=\"40px\" DataField=\"SubmittedCount\" HeaderImageUrl=\"~/images/actions/submit_report_hover.png\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-HorizontalAlign=\"Center\" ItemStyle-Height=\"40px\" DataField=\"ApproveCount\" HeaderImageUrl=\"~/images/actions/approve_hover.png\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-HorizontalAlign=\"Center\" ItemStyle-Height=\"40px\" DataField=\"RejectCount\" HeaderImageUrl=\"~/images/actions/reject_hover.png\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-HorizontalAlign=\"Center\" ItemStyle-Height=\"40px\" DataField=\"EditCount\" HeaderImageUrl=\"~/images/actions/edit_icon.png\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-HorizontalAlign=\"Center\" ItemStyle-Height=\"40px\" DataField=\"LockCount\" HeaderImageUrl=\"~/images/actions/lock.png\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-HorizontalAlign=\"Center\" ItemStyle-Height=\"40px\" DataField=\"PendingCount\" Hea derImageUrl=\"~/images/actions/pending_icon_hover.png\" /> <asp:BoundField ItemStyle-Width=\"40px\" ItemStyle-HorizontalAlign=\"Center\" ItemStyle-Height=\"40px\" DataField=\"Repor tCount\" /> </Columns> </asp:GridView> </td> </tr> </table> </asp:Panel> 解决方案 (function () {(\"[id*=imgLevel1]\").each(function () { if ((this)[0].src.indexOf(\"minus\") != -1) {I have four nested grid view When I click + image the next grid view will open but the problem is the inner grid appears after leaving a columns like this now i want that inner grid should also appear same without leaving columns in left and right side- A 0 0 0 0 + B 0 0 0 0Is there any way to do this<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script type="text/javascript"> $(function () { $("[id*=imgLevel1]").each(function () { if ($(this)[0].src.indexOf("minus") != -1) { $(this).closest("tr").after("<tr><td colspan = '10'>" + $(this).next().html() + "</td></tr>"); $(this).next().remove(); } }); $("[id*=imgLevel2]").each(function () { if ($(this)[0].src.indexOf("minus") != -1) { $(this).closest("tr").after("<tr><><td colspan = '10'>" + $(this).next().html() + "</td></tr>"); $(this).next().remove(); } }); $("[id*=imgLevel3]").each(function () { if ($(this)[0].src.indexOf("minus") != -1) { $(this).closest("tr").after("<tr><td colspan = '10'>" + $(this).next().html() + "</td></tr>"); $(this).next().remove(); } }); }); </script><asp:Panel runat="server" ID="pnlLevel1" BorderColor="Gray" BorderWidth="1px" Width="100%" > <table style="width:100%; height:100%;"> <tr> <td> <asp:GridView ID="gvLevel1" runat="server" AutoGenerateColumns="false" PageSize="40" Width="100%" Height="100%" DataKeyNames="LocID" onrowdatabound="gvLevel1_RowDataBound"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:ImageButton ID="imgLevel1" runat="server" OnClick="Show_Hide_Level1Grid" ImageUrl="~/images/plus.png" CommandArgument="Show" /> <asp:Panel ID="pnlLevel2" runat="server" Style="position: relative;margin-left:-5px; border-color:Red; border-width:1px;" Width="100%"> <asp:GridView ID="gvLevel2" runat="server" AutoGenerateColumns="false" Width="100%" ShowHeader="false" DataKeyNames="LocID" PageSize="40" OnRowDataBound="gvLevel2_RowDataBound" Style="position: relative;margin-left:-5px;"> <Columns> <asp:TemplateField ItemStyle-Width="40px"> <ItemTemplate> <asp:ImageButton ID="imgLevel2" runat="server" OnClick="Show_Hide_Level2Grid" ImageUrl="~/images/plus.png" CommandArgument="Show" /> <asp:Panel ID="pnlLevel3" runat="server" Style="position: relative;margin-left:-7px;" Width="100%"> <asp:GridView ID="gvLevel3" runat="server" AutoGenerateColumns="false" Width="100%" onrowdatabound="gvLevel3_RowDataBound" ShowHeader="false" Style="position: relative;margin-left:-6px;" DataKeyNames="LocID" PageSize="40"> <Columns> <asp:TemplateField ItemStyle-Width="40px"> <ItemTemplate> <asp:ImageButton ID="imgLevel3" runat="server" OnClick="Show_Hide_Level3Grid" ImageUrl="~/images/plus.png" CommandArgument="Show" /> <asp:Panel ID="pnlLevel4" runat="server" Style="position: relative;margin-left:-7px;" Width="100%"> <asp:GridView ID="gvLevel4" runat="server" AutoGenerateColumns="false" PageSize="40" Width="100%" ShowHeader="false" Style="position: relative;margin-left:-6px;" onrowdatabound="gvLevel4_RowDataBound" DataKeyNames="LocID"> <Columns> <asp:BoundField ItemStyle-Width="390px" ItemStyle-HorizontalAlign="Center" DataField="SubName" ItemStyle-Font-Bold="true"/> <asp:BoundField ItemStyle-Width="40px" ItemStyle-HorizontalAlign="Center" DataField="DraftCount" ItemStyle-Height="40px" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-Height="40px" ItemStyle-HorizontalAlign="Center" DataField="SubmittedCount" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-Height="40px" ItemStyle-HorizontalAlign="Center" DataField="ApproveCount" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-Height="40px" ItemStyle-HorizontalAlign="Center" DataField="RejectCount" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-Height="40px" ItemStyle-HorizontalAlign="Center" DataField="EditCount" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-Height="40px" ItemStyle-HorizontalAlign="Center" DataField="LockCount" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-Height="40px" ItemStyle-HorizontalAlign="Center" DataField="PendingCount" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-Height="40px" ItemStyle-HorizontalAlign="Center" DataField="ReportCount" /> </Columns> </asp:GridView> </asp:Panel> </ItemTemplate> </asp:TemplateField> <asp:BoundField ItemStyle-Width="323px" ItemStyle-HorizontalAlign="Center" DataField="SubName" ItemStyle-Font-Bold="true"/> <asp:BoundField ItemStyle-Width="40px" ItemStyle-HorizontalAlign="Center" DataField="DraftCount" ItemStyle-Height="40px" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-Height="40px" ItemStyle-HorizontalAlign="Center" DataField="SubmittedCount" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-Height="40px" ItemStyle-HorizontalAlign="Center" DataField="ApproveCount" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-Height="40px" ItemStyle-HorizontalAlign="Center" DataField="RejectCount" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-Height="40px" ItemStyle-HorizontalAlign="Center" DataField="EditCount" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-Height="40px" ItemStyle-HorizontalAlign="Center" DataField="LockCount" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-Height="40px" ItemStyle-HorizontalAlign="Center" DataField="PendingCount" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-Height="40px" ItemStyle-HorizontalAlign="Center" DataField="ReportCount" /> </Columns> </asp:GridView> </asp:Panel> </ItemTemplate> </asp:TemplateField> <asp:BoundField ItemStyle-Width="313px" ItemStyle-HorizontalAlign="Center" DataField="SubName" ItemStyle-Font-Bold="true"/> <asp:BoundField ItemStyle-Width="42px" DataField="DraftCount" ItemStyle-HorizontalAlign="Center" ItemStyle-Height="40px" /> <asp:BoundField ItemStyle-Width="40px" DataField="SubmittedCount" ItemStyle-HorizontalAlign="Center" ItemStyle-Height="40px" /> <asp:BoundField ItemStyle-Width="40px" DataField="ApproveCount" ItemStyle-HorizontalAlign="Center" ItemStyle-Height="40px" /> <asp:BoundField ItemStyle-Width="40px" DataField="RejectCount" ItemStyle-HorizontalAlign="Center" ItemStyle-Height="40px" /> <asp:BoundField ItemStyle-Width="40px" DataField="EditCount" ItemStyle-HorizontalAlign="Center" ItemStyle-Height="40px" /> <asp:BoundField ItemStyle-Width="40px" DataField="LockCount" ItemStyle-HorizontalAlign="Center" ItemStyle-Height="40px" /> <asp:BoundField ItemStyle-Width="40px" DataField="PendingCount" ItemStyle-HorizontalAlign="Center" ItemStyle-Height="40px" /> <asp:BoundField ItemStyle-Width="40px" DataField="ReportCount" ItemStyle-HorizontalAlign="Center" ItemStyle-Height="40px" /> </Columns> </asp:GridView> </asp:Panel> </ItemTemplate> </asp:TemplateField> <asp:BoundField ItemStyle-Width="300px" ItemStyle-HorizontalAlign="Center" ItemStyle-Height="40px" DataField="SubName" HeaderText="Location Name" ItemStyle-Font-Bold="true"/> <asp:BoundField ItemStyle-Width="40px" ItemStyle-HorizontalAlign="Center" ItemStyle-Height="40px" DataField="DraftCount" HeaderImageUrl="~/images/actions/draft.png" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-HorizontalAlign="Center" ItemStyle-Height="40px" DataField="SubmittedCount" HeaderImageUrl="~/images/actions/submit_report_hover.png" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-HorizontalAlign="Center" ItemStyle-Height="40px" DataField="ApproveCount" HeaderImageUrl="~/images/actions/approve_hover.png" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-HorizontalAlign="Center" ItemStyle-Height="40px" DataField="RejectCount" HeaderImageUrl="~/images/actions/reject_hover.png" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-HorizontalAlign="Center" ItemStyle-Height="40px" DataField="EditCount" HeaderImageUrl="~/images/actions/edit_icon.png" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-HorizontalAlign="Center" ItemStyle-Height="40px" DataField="LockCount" HeaderImageUrl="~/images/actions/lock.png" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-HorizontalAlign="Center" ItemStyle-Height="40px" DataField="PendingCount" HeaderImageUrl="~/images/actions/pending_icon_hover.png" /> <asp:BoundField ItemStyle-Width="40px" ItemStyle-HorizontalAlign="Center" ItemStyle-Height="40px" DataField="ReportCount" /> </Columns> </asp:GridView> </td> </tr></table> </asp:Panel> 解决方案 (function () {("[id*=imgLevel1]").each(function () { if ((this)[0].src.indexOf("minus") != -1) { 这篇关于嵌套网格视图的大小不合适的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-03 22:56