This is a segment of the codes in my code behind form and aspx page as well. <BR><BR>C# code behind form codes: <BR><BR> private void Page_Load(object sender, System.EventArgs e) <BR> { <BR> int choice; <BR><BR> choice=Convert.ToInt32(Request.QueryString["Goto"]); <BR> status=Convert.ToInt32(Request.QueryString["Status"]); <BR><BR> //open application in excel <BR> if (choice==1) <BR> { <BR> Response.Buffer=true; <BR> Response.ContentType="application/"; <BR> } <BR> <BR> //open application in browser <BR> else <BR> { <BR> excel.Text="Send to Excel 97"; <BR> label2.Text="&#124"; <BR> query.Text="Query/Report List"; <BR> excel.NavigateUrl="javascript:ConfirmExcel()"; <BR> <BR> MyDataGrid.VirtualItemCount = 200; <BR> } <BR> <BR> <BR><BR> // Retrieve the segment of data to display on the page from the <BR> // data source and bind it to the DataGrid control. <BR> BindGrid(); <BR><BR> <BR> } <BR><BR>ICollection CreateDataSource() <BR> { <BR><BR> // Create sample data for the DataGrid control. <BR> DataTable dt = new DataTable(); <BR> DataRow dr; <BR><BR> // Define the columns of the table. <BR> dt.Columns.Add(new DataColumn("IntegerValue", typeof(Int32))); <BR> dt.Columns.Add(new DataColumn("StringValue", typeof(string))); <BR> dt.Columns.Add(new DataColumn("DateTimeValue", typeof(string))); <BR> dt.Columns.Add(new DataColumn("BoolValue", typeof(bool))); <BR><BR> // Populate the table with sample values. When using custom paging, <BR> // a query should only return enough data to fill a single page, <BR> // beginning at the start index. <BR> for (int i = startIndex; i &#060; (startIndex + MyDataGrid.PageSize); i++) <BR> { <BR> dr = dt.NewRow(); <BR><BR> dr[0] = i; <BR> dr[1] = "Item " + i.ToString(); <BR> dr[2] = DateTime.Now.ToShortDateString(); <BR> dr[3] = (i % 2 != 0) ? true : false; <BR><BR> dt.Rows.Add(dr); <BR> } <BR><BR> DataView dv = new DataView(dt); <BR> return dv; <BR><BR> } <BR><BR> <BR> <BR><BR> <BR><BR> void MyDataGrid_Page(Object sender, DataGridPageChangedEventArgs e) <BR> { <BR><BR> // For the DataGrid control to navigate to the correct page when <BR> // paging is allowed, the CurrentPageIndex property must be updated <BR> // programmatically. This process is usually accomplished in the <BR> // event-handling method for the PageIndexChanged event. <BR><BR> // Set CurrentPageIndex to the page the user clicked. <BR> MyDataGrid.CurrentPageIndex = e.NewPageIndex; <BR><BR> // Calculate the index of the first item to display on the page <BR> // using the current page index and the page size. <BR> startIndex = MyDataGrid.CurrentPageIndex * MyDataGrid.PageSize; <BR><BR> // Retrieve the segment of data to display on the page from the <BR> // data source and bind it to the DataGrid control. <BR> BindGrid(); <BR><BR> } <BR><BR> void BindGrid() <BR> { <BR><BR> MyDataGrid.DataSource = CreateDataSource(); <BR> MyDataGrid.DataBind(); <BR><BR> } <BR><BR>Codes on aspx page: <BR><BR>&#060;SCRIPT LANGUAGE=javascript&#062; <BR>function ConfirmExcel() <BR>{ <BR>var msg; <BR><BR> msg = "You have chosen to send the query result into Excel 97,
"; <BR> msg = msg + "please note that this will display all the results and will
"; <BR> msg = msg + "take longer than normal.Your system may appear to hang
"; <BR> msg = msg + "and if Excel does not load please close some of your running
"; <BR> msg = msg + "applications and try again.

"; <BR> msg = msg + "Click Ok to Proceed, Cancel to abort."; <BR> if (confirm(msg)) <BR> { <BR> window.location.replace("E1_Summary.aspx?Goto=1"); <BR> <BR> } <BR>}