Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在GridView中对齐行值_C#_Asp.net_.net 3.5_Gridview - Fatal编程技术网

C# 在GridView中对齐行值

C# 在GridView中对齐行值,c#,asp.net,.net-3.5,gridview,C#,Asp.net,.net 3.5,Gridview,我需要右对齐asp.net 3.5中gridview列中的值 我该怎么做 <asp:GridView ID="gvSearchResults" runat="server" onpageindexchanging="gvSearchResults_PageIndexChanging" AutoGenerateColumns="False"

我需要右对齐asp.net 3.5中gridview列中的值 我该怎么做

                                <asp:GridView ID="gvSearchResults" runat="server" 
                                onpageindexchanging="gvSearchResults_PageIndexChanging" AutoGenerateColumns="False" 
                                CssClass="Grid" AllowPaging="True" PageSize="20" ForeColor="#333333" 
                                GridLines="None" Width="99%" Font-Names="Arial" Font-Size="Small">
                            <Columns>
                            <asp:HyperLinkField Text="Vendor Number" DataNavigateUrlFields="RecID" DataNavigateUrlFormatString="~/Apps/DataForms/Processor/ProcPanel.aspx?RecID={0}" DataTextField="VendorNum">
                                <HeaderStyle HorizontalAlign="Center" />
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:HyperLinkField>
                                <asp:BoundField DataField="VendorName" HeaderText="Vendor Name" HtmlEncode="False" ItemStyle-HorizontalAlign="Left"></asp:BoundField>
                                <asp:BoundField DataField="InvoiceNum" HeaderText="Invoice Number" HtmlEncode="False"></asp:BoundField>
                                <asp:BoundField DataField="InvoiceTot" HeaderText="Invoice Total" HtmlEncode="False" DataFormatString="${0:0,0.00}"></asp:BoundField>
                                <asp:BoundField DataField="InvoiceDate" HeaderText="Invoice Date"  HtmlEncode="False"></asp:BoundField>
                                <asp:BoundField DataField="InvoiceApprover" HeaderText="Invoice Approver"  HtmlEncode="False"></asp:BoundField>
                            </Columns>
                                <RowStyle BackColor="#FFFBD6" ForeColor="#333333"/>
                                <FooterStyle CssClass="GridFooter" />
                                <PagerStyle CssClass="GridPager" ForeColor="White" />
                                <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                                <HeaderStyle CssClass="GridHeader"  />
                            </asp:GridView>


或者,创建一个CSS类,将
文本对齐
值设置为
右侧
。然后可以将项的
CssClass
属性设置为类。

我认为您需要使用行样式:

<asp:GridView>
   <RowStyle HorizontalAlign="Right" />
</asp:GridView>

嗯,这很奇怪,你能发布一个代码片段来显示你在做什么吗?代码片段中的行样式没有水平对齐。你是不是在它不起作用的时候把它拿走了?我是在它不起作用后把它拿走的。但真正的罪魁祸首是CssClass=“Grid”。这是在覆盖我的对齐方式。我找到了。有一个CSS类对我的东西的一部分过于重视;
<RowStyle HorizontalAlign="Right" />
<asp:GridView>
   <RowStyle HorizontalAlign="Right" />
</asp:GridView>