Mamta Jain

Mamta Jain

  • NA
  • 417
  • 14.4k

code has not been effect on form load event .

Jan 10 2017 12:13 AM
I have done coding of serial number in grid view in the load event of the form but when I am executing the form , The serial number code has not been shown  in data grid view . but  when same load event when I am calling from the button_Click event than Data grid view serial number is seen . why this happening ? 
 
Load event of form :
 
private void Frm_View_Upload_Paper_Load(object sender, EventArgs e)
{
      lan_id = que.language_ID();
      DataSet ds = new DataSet();
      string query = "Select * from VW_file_Upload_Download";
      ds = que.execute_query_with_ds(query, connection);
 
      if (ds.Tables[0].Rows.Count == 0)
            {
            DGV_View.DataSource = null;
            }
      else
            {
            DGV_View.DataSource = ds.Tables[0];
             sr_no start..
             int srno = 1;
             for (int i = 0; i < DGV_View.Rows.Count; i++)
                  {
                     DGV_View.Rows[i].Cells["Sr_No"].Value = srno;                  
                      srno = srno + 1;
                   }
            } 
 
 
Button_Click Event :
 
private void button2_Click(object sender, EventArgs e)
         {
         Frm_View_Upload_Paper_Load(null, null);
         }
 
 
 
 
 
 

Answers (4)