I did a code for a features where I uploaded the file and it will get saved into database and files folder (for filePath). But when I run and after uploaded the file, the gridview did not appear and showing the file that already uploaded. I tried turn to AutoGenerateColums=true and databind(). but the gridview still did not appear. What I'm doing wrong here?
this code for gridview design :
this is my code for gridview :
protected void bind() { try { dbconn(); SqlCommand cmd = new SqlCommand("select * from ScheduleTable", con); SqlDataAdapter adp = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); adp.Fill(ds); SqlDataReader rd = cmd.ExecuteReader(); if (rd.Read()) { GridView1.DataSource = ds; GridView1.DataBind(); }//end if else { ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); GridView1.DataSource = ds; GridView1.DataBind(); int columncount = GridView1.Rows[0].Cells.Count; GridView1.Rows[0].Cells.Clear(); GridView1.Rows[0].Cells.Add(new TableCell()); GridView1.Rows[0].Cells[0].ColumnSpan = columncount; GridView1.Rows[0].Cells[0].Text = "No Record(s) Found"; }//end else }//end try catch (Exception ex) { Response.Write(ex.Message); }//end catch }//end bind()