
hey kusuma,
firstly put this code in your
business access layer(bal) class
create objects for classes
//dal da=new dal();
//bal ba=new bal();
public DataTable load()
{
dal da = new dal();
return da.load();
}
data access layer(dal) code
public DataTable load()
{
db.mycon();
bol bo = new bol();
bal ba = new bal();
SqlDataAdapter adp = new SqlDataAdapter("sample_dml_proc", db.con);
adp.SelectCommand.CommandType = CommandType.StoredProcedure;
adp.SelectCommand.Parameters.Add("@status", SqlDbType.VarChar).Value = "display";
DataSet ds = new DataSet();
adp.Fill(ds, "table1");
return ds.Tables["table1"];
}[
default.aspx.cs
public DataTable gridv()
{
db.mycon();
bal ba = new bal();
DataTable dt = new DataTable();
dt= ba.load();
return dt;
}
public void fillgrid()
{
db.mycon();
GridView1.DataSource = gridv();
GridView1.DataBind();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
fillgrid();
}
}
change according to ur need
mark if this help u
Kusuma, if this helps please login to Mark As Answer. | Alert Moderator