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 ?
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);
}