我的桌子布局有问题。正如您在屏幕截图中看到的那样,gridview中有一个网格视图。您看到的示例有3个网格视图,主视图和两个表中的一个。我想将描述放在价格2列中并删除第3个gridview。你能帮我找到让第二个表重叠到下一栏的解决方案吗?
由于
http://img43.imageshack.us/img43/9384/tabelf.jpg
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
AutoGenerateDeleteButton="False" AutoGenerateEditButton="False"
onrowcancelingedit="GridView1_RowCancelingEdit"
onrowdeleting="GridView1_RowDeleting" onrowediting="GridView1_RowEditing"
onrowupdating="GridView1_RowUpdating" OnRowCommand="GridView1_RowCommand" style='table-layout: inherit'>
<Columns>
<asp:TemplateField HeaderText="Site ID">
<ItemTemplate>
<asp:Label ID="lblID" runat="server" Text='<%#Eval("ID") %>'></asp:Label>
<%--<asp:Label ID="Label1" runat="server" Text='<%# Container.DataItemIndex%>'></asp:Label>--%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Service Name">
<ItemTemplate>
<asp:Label ID="lbl" runat="server" Text='<%#Eval("firstName") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt" runat="server" Text='<%#Eval("firstName") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Price 1">
<ItemTemplate>
<asp:Label ID="lblPriceOne" runat="server" Text='test'></asp:Label>
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"
AutoGenerateDeleteButton="False" AutoGenerateEditButton="False">
<Columns>
<asp:BoundField DataField="lastName" HeaderText="lastName" SortExpression="lastName">
<ItemStyle Width="20%"/>
</asp:BoundField>
<asp:BoundField DataField="firstName" HeaderText="Discription" SortExpression="firstName">
<ItemStyle Width="20%" />
</asp:BoundField>
</Columns>
</asp:GridView>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Price 2">
<ItemTemplate>
<asp:Label ID="lblPriceTwo" runat="server" Text='test2'></asp:Label>
<asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False"
AutoGenerateDeleteButton="False" AutoGenerateEditButton="False">
<Columns>
<asp:BoundField DataField="lastName" HeaderText="lastName" SortExpression="lastName">
<ItemStyle Width="20%" />
</asp:BoundField>
<asp:BoundField DataField="firstName" HeaderText="Discription" SortExpression="firstName">
<ItemStyle Width="20%" />
</asp:BoundField>
</Columns>
</asp:GridView>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="">
<ItemTemplate>
<asp:Button ID="btnShow" runat="server" Text="Expand" CommandName="Show" CommandArgument='<%# Container.DataItemIndex%>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>
答案 0 :(得分:1)