Hi,
I have two gridviews to which data is binded when page is not posted back.
when i run for first time the data is binded to gridview, and when i run next time the data is not binded to grid view.
the code is:
public partial class _Default : System.Web.UI.P age
{
public static DataTable tableGrid1 = new DataTable();
protected void Page_Load(objec t sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
}
public void BindData()
{
DataColumn columnGrid1 = new DataColumn(); // Binding data to the tableGrid1
columnGrid1.Col umnName = "TeamName";
tableGrid1.Colu mns.Add(columnG rid1);
DataRow dr1 = tableGrid1.NewR ow();
dr1[0] = "AAAAAAA";
tableGrid1.Rows .Add(dr1);
DataRow dr2 = tableGrid1.NewR ow();
dr2[0] = "BBBBBBBB";
tableGrid1.Rows .Add(dr2);
DataRow dr3 = tableGrid1.NewR ow();
dr3[0] = "CCCCCCC";
tableGrid1.Rows .Add(dr3);
DataRow dr4 = tableGrid1.NewR ow();
dr4[0] = "DDDDDDDDD" ;
tableGrid1.Rows .Add(dr4);
DataRow dr5 = tableGrid1.NewR ow();
dr5[0] = "EEEEEEEEE" ;
tableGrid1.Rows .Add(dr5);
tableGrid1.Rows .Add(tableGrid1 .NewRow());
GridView1.DataS ource = tableGrid1;
GridView1.DataB ind();
}
}
when i run second time without rebuild it is not working
pls help me...
i m going mad !!!
bye
hydson
I have two gridviews to which data is binded when page is not posted back.
when i run for first time the data is binded to gridview, and when i run next time the data is not binded to grid view.
the code is:
public partial class _Default : System.Web.UI.P age
{
public static DataTable tableGrid1 = new DataTable();
protected void Page_Load(objec t sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
}
public void BindData()
{
DataColumn columnGrid1 = new DataColumn(); // Binding data to the tableGrid1
columnGrid1.Col umnName = "TeamName";
tableGrid1.Colu mns.Add(columnG rid1);
DataRow dr1 = tableGrid1.NewR ow();
dr1[0] = "AAAAAAA";
tableGrid1.Rows .Add(dr1);
DataRow dr2 = tableGrid1.NewR ow();
dr2[0] = "BBBBBBBB";
tableGrid1.Rows .Add(dr2);
DataRow dr3 = tableGrid1.NewR ow();
dr3[0] = "CCCCCCC";
tableGrid1.Rows .Add(dr3);
DataRow dr4 = tableGrid1.NewR ow();
dr4[0] = "DDDDDDDDD" ;
tableGrid1.Rows .Add(dr4);
DataRow dr5 = tableGrid1.NewR ow();
dr5[0] = "EEEEEEEEE" ;
tableGrid1.Rows .Add(dr5);
tableGrid1.Rows .Add(tableGrid1 .NewRow());
GridView1.DataS ource = tableGrid1;
GridView1.DataB ind();
}
}
when i run second time without rebuild it is not working
pls help me...
i m going mad !!!
bye
hydson
Comment