Search This Blog

09 February 2011

Globally Gridview Binding

public void bindgrid(GridView gv, string query)
{
ds.Clear();
cmd.CommandText = query;
adp.Fill(ds, "vt1");
gv.DataSource = ds.Tables["vt1"];
gv.DataBind();
}
}


// How to call this global function in managecourse.aspx.cs file //

public partial class managecourse : System.Web.UI.Page
{
connection c = new connection();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
c.bindgrid(GridView1, "select * from student");
}
}
}

No comments:

Post a Comment