Shifting gridview headers to the left

I have a gridview (sceenshot attached). You see how the header is shifted to the right. I used controlstyle css to move it to the left but doesnt look like that's the correct one...

How can I do this? Part of the grid code is also below
<asp:TemplateField    HeaderText="User Name">
           <ItemTemplate  >
              <asp:Label ID="Labelx" runat="server" Text='<%# Eval("Username") %>' >
		        </asp:Label>
           </ItemTemplate>
           <EditItemTemplate >
               <asp:TextBox ID="txtUserName" runat="server" Text='<%# Eval("Username")%>'  ></asp:TextBox>
               <span class="feedback"><asp:RequiredFieldValidator ControlToValidate="txtUserName" runat="server" ID="rfv1" Text="User Name is required!" ErrorMessage="User Name is required!"></asp:RequiredFieldValidator></span>
           </EditItemTemplate>
               </asp:TemplateField>
           <asp:TemplateField  HeaderText="Business Name">
           <ItemTemplate>
               <asp:Label ID="Label1" runat="server" Text='<%# Eval("BusinessName") %>'></asp:Label>
           </ItemTemplate>
          
           </asp:TemplateField>

Open in new window

Doc3.docx
LVL 8
CamilliaAsked:
Who is Participating?
 
Tom BeckCommented:
Or just add this just below your <asp:Gridview> control tag to get all header text aligned left:

<HeaderStyle HorizontalAlign="Left" />
0
 
Tom BeckCommented:
<asp:TemplateField HeaderText="User Name" HeaderStyle-HorizontalAlign="Left">
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.