I want to generate nested grid view from grid view row add button.if i click add button nested grid view have to be generate based on parent grid ID.
For example parent grid id=1 means while clicking add nested grid row have to be generated with auto increment ID while each time clicking add button(like 1.1,1.2) If second row from parent grid means 2.1,2.2 like this have to create in nested grid row id
What I have tried:
while clicking add in grid view row:
using two tables while concatenating 1.1,1.2 for first row.if i add in second row it showing 2.3 how to solve. using data table is easy means how to do it?
protected void OnSelectedIndexChanged(object sender, EventArgs e)
{
string Sid = GridState.SelectedRow.Cells[1].Text;
SqlConnection con = new SqlConnection(conString);
{
using (SqlCommand cmd = new SqlCommand("INSERT INTO City VALUES('" + TextBox3.Text + "' , '" + TextBox4.Text + "' , '" + TextBox5.Text+"' , " + Sid+")", con))
{
con.Open();
cmd.ExecuteNonQuery();
con.Close();
string sQuery1 = "SELECT CAST(S_id AS VARCHAR(20) ) +'.'+ CAST(City_id AS VARCHAR(20) ),City_code,City_name from City where S_id="+Sid;
string value=getData1(sQuery1).ToString();
}
}