[Last Call] Learn how to a build a cloud-first strategyRegister Now


Shifting gridview headers to the left

Posted on 2011-10-04
Medium Priority
Last Modified: 2012-06-27
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") %>' >
           <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>
           <asp:TemplateField  HeaderText="Business Name">
               <asp:Label ID="Label1" runat="server" Text='<%# Eval("BusinessName") %>'></asp:Label>

Open in new window

Question by:Camillia
  • 2
LVL 38

Expert Comment

by:Tom Beck
ID: 36912977
<asp:TemplateField HeaderText="User Name" HeaderStyle-HorizontalAlign="Left">
LVL 38

Accepted Solution

Tom Beck earned 2000 total points
ID: 36912993
Or just add this just below your <asp:Gridview> control tag to get all header text aligned left:

<HeaderStyle HorizontalAlign="Left" />

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month17 days, 17 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question