protected void Page_Load(object sender, EventArgs e) { UserInfoLogic usersList = new UserInfoLogic(); List <UserInfoItem> AllUsers = new List <UserInfoItem>(); AllUsers = usersList.GetAllData(); gvPerson.DataSource = AllUsers; FV1.DataSource = AllUsers; Rp1.DataSource = AllUsers; gvPerson.DataBind(); FV1.DataBind(); Rp1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { using (SqlConnection Connect = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString)) { SqlCommand cmd = new SqlCommand("select * from Student", Connect); Connect.Open(); SqlDataAdapter SDE = new SqlDataAdapter(cmd); //To retrive the data from database DataSet ds = new DataSet(); //to convert the data into the grid. SDE.Fill(ds, "Student"); Rp1.DataSource = ds; Rp1.DataBind(); Connect.Close(); } }