2016-11-16 11 views
1

です。購入タブのグリッドビューで編集をクリックすると、セルモードは正常ですが、セールスタブのグリッド表示セルモードは正確ではありません。私は今やらなければならない...私は購入タブのセルモードとしてセールスタブセルモードが必要です。より良い編集モードのグリッド表示セルの間隔はasp.net

enter image description here

とそのhtmlコード

 <asp:GridView ID="GridView1" runat="server" CssClass="dataGridTable" AutoGenerateColumns="False" Width="100%" AllowPaging="True" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataSourceID="ObjectDataSource1" HeaderStyle-Height="30" OnRowCreated="GridView1_RowCreated" PageSize="30" DataKeyNames="invoiceNumber,productName,productCategory" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" OnRowDeleting="GridView1_RowDeleting" OnRowUpdating="GridView1_RowUpdating" OnRowDataBound="GridView1_RowDataBound"> 
 
          <Columns> 
 

 
           <asp:CommandField ShowEditButton="true"/> 
 
           <asp:TemplateField ShowHeader="False"> 
 
            <ItemTemplate> 
 
             <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete"></asp:LinkButton> 
 
            </ItemTemplate> 
 
           </asp:TemplateField> 
 
           <asp:BoundField DataField="invoiceNumber" HeaderText="Invoice" ReadOnly="true" SortExpression="invoiceNumber" /> 
 
           <asp:BoundField DataField="productName" HeaderText="Name" ReadOnly="true" SortExpression="productName" /> 
 
           <asp:BoundField DataField="productCategory" HeaderText="Category" ReadOnly="true" SortExpression="productCategory" /> 
 
           <asp:BoundField DataField="totalQuantity" HeaderText="Quantity" SortExpression="totalQuantity" /> 
 
           <asp:BoundField DataField="totalPurchasePrice" HeaderText="Total Price" SortExpression="totalPurchasePrice" /> 
 
           <asp:BoundField DataField="salePricePerItem" HeaderText="Sale Price/Item" SortExpression="salePricePerItem" /> 
 
           <asp:BoundField DataField="comments" HeaderText="Comments" SortExpression="comments" /> 
 
           <asp:BoundField DataField="date" HeaderText="Date" ReadOnly="true" SortExpression="date" /> 
 

 
           
 
           <asp:TemplateField> 
 
            <ItemTemplate> 
 
             <asp:ImageButton ID="ImageButton1" runat="server" Height="24px" ImageUrl="~/Images/detailsInfo.png" Width="24px" OnClick="ImageButton1_Click" /> 
 
            </ItemTemplate> 
 
           </asp:TemplateField> 
 

 
          </Columns> 
 

 
          <FooterStyle BackColor="White" ForeColor="#000066" /> 
 
          <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" CssClass="gridHeaderAlignment" /> 
 
          <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" /> 
 
          <RowStyle ForeColor="#000066" HorizontalAlign="Center" VerticalAlign="Middle" /> 
 
          <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" /> 
 
          <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" /> 
 
          <SortedAscendingCellStyle BackColor="#F1F1F1" /> 
 
          <SortedAscendingHeaderStyle BackColor="#007DBB" /> 
 
          <SortedDescendingCellStyle BackColor="#CAC9C9" /> 
 
          <SortedDescendingHeaderStyle BackColor="#00547E" /> 
 
         </asp:GridView>

012を理解するために、私は絵を含めたよあなたが私に

を助けることを願って

とそのhtmlコード

     <asp:GridView ID="GridView1" runat="server" CssClass="dataGridTable" AutoGenerateColumns="False" Width="100%" AllowPaging="True" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataSourceID="ObjectDataSource1" HeaderStyle-Height="30" OnRowCreated="GridView1_RowCreated" PageSize="30" OnRowDeleting="GridView1_RowDeleting" OnRowUpdating="GridView1_RowUpdating" DataKeyNames="invoiceNumber,productName,productCategory"> 
 
          <Columns> 
 
           
 
           <asp:CommandField ShowEditButton="True" /> 
 
           <asp:TemplateField ShowHeader="False"> 
 
            <ItemTemplate> 
 
             <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete"></asp:LinkButton> 
 
            </ItemTemplate> 
 
           </asp:TemplateField> 
 
           <asp:BoundField DataField="invoiceNumber" HeaderText="Invoice" ReadOnly="true" SortExpression="invoiceNumber" /> 
 
           <asp:BoundField DataField="productName" HeaderText="Name" ReadOnly="true" SortExpression="productName" /> 
 
           <asp:BoundField DataField="productCategory" HeaderText="Category" ReadOnly="true" SortExpression="productCategory" /> 
 
           <asp:BoundField DataField="totalQuantity" HeaderText="Quantity" SortExpression="totalQuantity" /> 
 
           <asp:BoundField DataField="totalPrice" HeaderText="Price" SortExpression="totalPrice" /> 
 
           <asp:BoundField DataField="paidAmount" HeaderText="Paid Amount" SortExpression="paidAmount" /> 
 
           <asp:BoundField DataField="comments" HeaderText="Comments" SortExpression="comments" /> 
 
           <asp:BoundField DataField="date" HeaderText="Date" ReadOnly="true" SortExpression="date" /> 
 

 
           <asp:TemplateField> 
 
            <ItemTemplate> 
 
             <asp:ImageButton ID="ImageButton1" runat="server" Height="24px" ImageUrl="~/Images/detailsInfo.png" Width="24px" OnClick="ImageButton1_Click" /> 
 
            </ItemTemplate> 
 
           </asp:TemplateField> 
 
           
 
          </Columns> 
 

 
          <FooterStyle BackColor="White" ForeColor="#000066" /> 
 
          <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" CssClass="gridHeaderAlignment" /> 
 
          <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" /> 
 
          <RowStyle ForeColor="#000066" HorizontalAlign="Center" VerticalAlign="Middle" /> 
 
          <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" /> 
 
          <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" /> 
 
          <SortedAscendingCellStyle BackColor="#F1F1F1" /> 
 
          <SortedAscendingHeaderStyle BackColor="#007DBB" /> 
 
          <SortedDescendingCellStyle BackColor="#CAC9C9" /> 
 
          <SortedDescendingHeaderStyle BackColor="#00547E" /> 
 
         </asp:GridView>

+0

「購入タブのセルモードとして販売タブのセルモードが必要です」という意味ですか?私が見ることができる違いは、販売グリッドのテキストボックスの行幅を完全に取っていないことだけです。 –

+0

はい私は販売グリッドのテキストボックスの行全体の幅をしたい – Simon

答えて

1

あなたはバインドされたフィールドのItemStyleControlStyleプロパティを必要としています。 ItemStyleはgridview列のスタイルを変更し、ControlStyleはGridview列にあるコントロールのスタイルを変更します。

<asp:BoundField DataField="totalQuantity" HeaderText="Quantity" SortExpression="totalQuantity" /> 
     <ItemStyle Width="200px" /> 
     <ControlStyle Width="100%" /> 
    </asp:BoundField> 

ご希望に応じて幅を調整します。 スタイルを一般化する場合は、ControlStyle-CssClassまたはItemStyle-CssClassを使用することもできます。

+0

それは働く......ありがとう – Simon

関連する問題