ASP.Net AJAX GridView Loading using C#



Step 1: Take Script Manager first.

Step 2: Then take UpdateProgress Ajax Control (you can take load images...)

Step 3: Take UpdatePanel Control; in that take Gridview, button ok

Now double click on Button and Load Data the Data.

You have to create a method to bind the data to the Button.

You have to write code as shown below.

Coding..

   protected void Button1_Click(object sender, EventArgs e)
    {
        BindData();
    }
    protected void BindData()
    {
        SqlConnection cn = new SqlConnection("Data Source=SHASHI-PC;Initial Catalog=shashi;User ID=sa;word=omsairam");
        // SqlCommand cmd = new SqlCommand("select * from emp", cn);
        SqlDataAdapter da = new SqlDataAdapter("select * from emp", cn);
        DataSet ds = new DataSet();
        da.Fill(ds);

        System.Threading.Thread.Sleep(4000);

        GridView1.DataSource = ds.Tables[0];
        GridView1.DataBind();
    }

 


Similar Articles