protected void GridView_OnSelectedIndexChanged(object sender, EventArgs e) { CheckDeviceObjectDataSource.SelectParameters["ID_Device_Spares"].DefaultValue = GridDevice.SelectedValue.ToString(); CheckBoxParent.DataBind(); Selected_Unit(); for (int i = 0; i < CheckBoxParent.Items.Count; i++) { CheckBoxParent.Items[i].Selected = true; } TextBox2.Text = GridDevice.Rows[GridDevice.SelectedIndex].Cells[2].Text; Description.Text = GridDevice.Rows[GridDevice.SelectedIndex].Cells[3].Text; if (TreeViewUpdate.Nodes.Count != TreeView1.Nodes.Count) { TreeViewUpdate.Nodes.Clear(); PopulateRootLevel_Update(); } else { for (int i = 0; i < TreeViewUpdate.Nodes.Count; i++) { if (TreeViewUpdate.Nodes[i].Checked == true) { TreeViewUpdate.Nodes[i].Checked = false; } } } Load_Image(); ModalPopupExtender1.Show(); DivUpdatePanel.Visible = true; UpdateButton.Visible = true; InsertButton.Visible = false; DeleteButton.Visible = true; AddImge.Visible = true; }