asp:GridView column alignment : XML GridView « XML « ASP.Net

asp:GridView column alignment

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Configuration"%>
<%@ Import Namespace="System.Data"%>

<script runat="server">
    void Page_Load(Object sender, EventArgs e)
        DataSet authorsDataSet;
        string filePath = Server.MapPath("Authors.xml");
        authorsDataSet = new DataSet();
        //Read the contents of the XML file into the DataSet
        authorsGird.DataSource = authorsDataSet.Tables[0].DefaultView;

<html xmlns="" >
<head runat="server">
    <title>Reading XML Data into a DataSet object </title>
    <form id="form1" runat="server">
        <asp:GridView id="authorsGird" runat="server" 
            AutoGenerateColumns="False" CellPadding="4" HeaderStyle-BackColor="blue" HeaderStyle-ForeColor="White" 
            HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="True">
                <asp:BoundField HeaderText="Last Name" DataField="lastName" />
                <asp:BoundField HeaderText="First Name" 
                    DataField="firstName" ItemStyle-HorizontalAlign="Right" />


Related examples in the same category

1.Displaying XML Data in a GridView and a ListBox?
2.Load XML data to GridView