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);
}
4 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Mamta JainPosted Jan 10, 2017, 11:48 PM
Amit GuptaPosted Jan 10, 2017, 4:49 AM
Mamta JainPosted Jan 10, 2017, 12:34 AM
Chetan RanpariyaPosted Jan 10, 2017, 12:26 AM