New Member FAQ | Forums | Earn Revenue


Resources Entrance Ask Experts Exam Papers Jobs English Projects Universities Colleges Courses Schools Training My India



My Profile
Active Members
TodayLast 7 Days more...



Awards & Gifts
Online Exams

Fresher Jobs


Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi

Resources


Find educational articles, blogs, discussion threads and other resources.

Colleges


Find details about any college in India or search for courses.

website counter



How to show Empty gridview using C#?


Posted Date:     Total Responses: 0    Posted By: UltimateRengan   Member Level: Gold   Points/Cash: 4   


How to show Empty gridview using C#?





Drag and drop the Gridview control to page
Just create the Datatable and bind it to Gridview control.





using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataRow dtrow;
DataTable dtNewTable;
dtNewTable = new DataTable();
DataColumn dtcol, dtcol1;
dtcol = new DataColumn();
dtcol1 = new DataColumn();
dtcol.DataType = System.Type.GetType("System.String");
dtcol.ColumnName="Emp ID";
dtNewTable.Columns.Add(dtcol);
dtcol1.DataType = System.Type.GetType("System.String");
dtcol1.ColumnName = "Emp Name";
dtNewTable.Columns.Add(dtcol1);
int i;
for (i = 0; i < 4; i++)
{


dtrow = dtNewTable.NewRow();
dtrow["Emp ID"]= "";
dtrow["Emp Name"] = "";
dtNewTable.Rows.Add(dtrow);

GridView1.DataSource = dtNewTable;
GridView1.DataBind();
}

}
}


Project Feedbacks

Author: Davis ThomasMember Level: BronzeRevenue Score: 1 out of 5
this is gud, presently i am doing my project in C #


Post Feedback
You must Sign In to post a feedback.
Next Project: Connection Between SAP and Dotnet
Previous Project: Create Controls using Placeholder in ASP.Net

Return to Project Index

Post New Project


Related Projects






Contact Us   Advertise   Editors    Privacy Policy    Terms Of Use   

AdSense Revenue Sharing sites

ISC Technologies.
2006 - 2009 All Rights Reserved.