【问题标题】:Aligning the headers in gridview with an item and moving the item content to right将gridview中的标题与项目对齐并将项目内容向右移动
【发布时间】:2021-03-17 16:27:21
【问题描述】:

我有一个非常简单的网格视图,如下所示:

我想将标题与内容对齐,因此衬衫应位于标题项下方。描述需要移到左边,价格 336 应该移到右边。我想要这样的东西:

下面是我的代码:

<asp:GridView ID="grdShoppingCart" runat="server" AutoGenerateColumns="false" class="ui-responsive table-stroke ss-table ui-search-result-table" GridLines="None">
            <Columns>
                <asp:BoundField DataField="item" HeaderText="Item" HeaderStyle-Font-Bold="true" ItemStyle-Width="35%"  />
                <asp:TemplateField HeaderText="Description" HeaderStyle-Font-Bold="true" ItemStyle-Width="35%"  >
                    <ItemTemplate>
                        <asp:Label ID="lblDesc" runat="server" Text='<%# Eval("desc") %>' /><br />
                        &nbsp;Requested By: &nbsp;<asp:Label ID="lblDesc1" runat="server" Text='<%# Eval("RequestedBy") %>' />
                    </ItemTemplate>

                </asp:TemplateField>
                   <asp:TemplateField HeaderText="Quantity" ItemStyle-Width="10%" >
                    <ItemTemplate>
                            <input type="number" id="txtQuantity" value='<%# Eval("Quantity") %>'   style="text-align:right;" data-mini="true" min="1" max="100" runat="server"/>
                    </ItemTemplate>
                </asp:TemplateField>
                   <asp:TemplateField HeaderText="Price" ItemStyle-Width="100%" HeaderStyle-HorizontalAlign="Right">
                    <ItemTemplate>
                            <asp:Label  ID="lblPrice" runat="server" Text= '<%# Int32.Parse(Eval("Quantity").ToString()) * 28 %>' />
                    </ItemTemplate>
                  </asp:TemplateField>

            </Columns>



 </asp:GridView>

任何帮助将不胜感激。

【问题讨论】:

    标签: css asp.net


    【解决方案1】:

    你试过了吗?

    <asp:Label id="Label1" runat="server" width="100px" style="text-align: right;" />
    

    【讨论】:

      猜你喜欢
      • 2017-06-18
      • 2016-09-04
      • 2022-01-24
      • 2011-04-12
      • 1970-01-01
      • 2021-02-21
      • 2017-05-21
      • 1970-01-01
      • 2020-04-18
      相关资源
      最近更新 更多