Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Contributor
2094 Points
539 Posts
May 17, 2012 07:03 AM|LINK
Hi,
Try like this
public void FillGrid() { try { DataSet ds = new DataSet(); ds = Button_Select1( U can pass ur parameters in this ); if (ds.Tables[0].Rows.Count == 0) { ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); Gv1.DataSource = ds; Gv1.DataBind(); Gv1.Rows[0].Visible = false; } else { Gv1.DataSource = ds; Gv1.DataBind(); Gv1.Visible = true; } } catch (Exception ex) { throw ex; } }
And in ur
protected void Gv1_SelectedIndexChanged(object sender, EventArgs e) {
Button_Select1( U can pass ur parameters in this ); // U can bind thst function...
}
Reply me for any issues..
kirupa.v
Contributor
2094 Points
539 Posts
Re: if dataset is null, how to prevent dataset to bind in grid view.
May 17, 2012 07:03 AM|LINK
Hi,
Try like this
public void FillGrid()
{
try
{
DataSet ds = new DataSet();
ds = Button_Select1( U can pass ur parameters in this );
if (ds.Tables[0].Rows.Count == 0)
{
ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
Gv1.DataSource = ds;
Gv1.DataBind();
Gv1.Rows[0].Visible = false;
}
else
{
Gv1.DataSource = ds;
Gv1.DataBind();
Gv1.Visible = true;
}
}
catch (Exception ex)
{
throw ex;
}
}
And in ur
protected void Gv1_SelectedIndexChanged(object sender, EventArgs e)
{
Button_Select1( U can pass ur parameters in this ); // U can bind thst function...
}
Reply me for any issues..