using System; using System.Data; using System.Configuration; 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.Data.SqlClient; /// /// Summary description for FillGrid /// public class FillGrid { SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString); DataSet ds = new DataSet(); public FillGrid() { // // TODO: Add constructor logic here // } public void Get_GVFill(ref GridView Grid, String Select, String Where, String Order, ref Label err) { try { SqlDataAdapter adp = new SqlDataAdapter("SELECT " + Select + " " + Where + " " + Order, con); adp.Fill(ds, "GV_" + Grid.ID); adp.Dispose(); Grid.DataSource = ds.Tables["GV_" + Grid.ID]; Grid.DataBind(); } catch (Exception exp) { err.Text = ("GV Alert! : " + exp.Message); } finally { con.Close(); } } }