Home > DeveloperSection > Articles > Introduction to Dataset XSD file

Introduction to Dataset XSD file


ASP.Net ASP.Net 
Ratings:
0 Comment(s)
 6439  View(s)
Rate this:

Introduction to Dataset XSD file

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"

            GridLines="None">

            <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" />

        </asp:GridView>

 

 

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)

    {

        loadMyGrid();

       

    }

 

    public void loadMyGrid()

    {

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

        MyData.EmployeeDataTable table = adapter.GetData();

        myGrid.DataSource = table;

        myGrid.DataBind();

    }

}

 

 

I hope this article will help you.


Don't want to miss updates? Please click the below button!

Follow MindStick