In this article, I am going to discuss how a Dataset XSD file can be used to bind a GridControl. XSD file can be created by Add New Item-> Dataset file and give a suitable name and put it under App_Code folder.

MyData.xsd File:-

Introduction to Dataset XSD file

Default.aspx Code:

<asp:GridView ID="myGrid" runat="server" CellPadding="4" ForeColor="#333333"


            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />

            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />

            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />

            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

            <EditRowStyle BackColor="#999999" />

            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />


Default.aspx.cs Code:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Data.SqlClient;

using System.Data;


public partial class _Default : System.Web.UI.Page


    SqlConnection conn = new SqlConnection("Data Source=CHNVEL2BLM06;Initial Catalog=master;Integrated Security=true");


    protected void Page_Load(object sender, EventArgs e)






    public void loadMyGrid()


        MyDataTableAdapters.EmployeeTableAdapter adapter=new MyDataTableAdapters.EmployeeTableAdapter();

        MyData.EmployeeDataTable table = adapter.GetData();

        myGrid.DataSource = table;





I hope this article will help you.

  Modified On Nov-29-2017 07:32:25 AM

Leave Comment