Hi.
I have two gridviews in a form: Master and Detail. I am trying to set the focus on Detail Grid when the Master grid UserAddedRow Event occurs. I tried with Telerik grids, but, it doesn't work. The focus always stays in the Master grid.
In other question, you answer me with the below code sample, but, this sample shows the Detail grid inside the Master grid. My customer wants to do what I am showing in the PNG attachment, in order to make the fingering fast.
The sample in PNG was developed in native VS DataGridView.
Thanks
Code sample:
DataTable masterTable = new DataTable(); DataTable childTable = new DataTable(); public RadForm1() { InitializeComponent(); masterTable.Columns.Add("Id", typeof(int)); masterTable.Columns.Add("Name", typeof(string)); for (int i = 0; i < 3; i++) { masterTable.Rows.Add(i, "Row" + i); } childTable.Columns.Add("Id", typeof(int)); childTable.Columns.Add("ParentId", typeof(int)); childTable.Columns.Add("Title", typeof(string)); childTable.Columns.Add("Date", typeof(DateTime)); Random rand = new Random(); for (int i = 0; i < 20; i++) { childTable.Rows.Add(i, rand.Next(0, 3), "Child" + i, DateTime.Now.AddDays(i)); } radGridView1.DataSource = masterTable; radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; GridViewTemplate template = new GridViewTemplate(); template.DataSource = childTable; template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; radGridView1.MasterTemplate.Templates.Add(template); GridViewRelation relation = new GridViewRelation(radGridView1.MasterTemplate); relation.ChildTemplate = template; relation.RelationName = "MasterChild"; relation.ParentColumnNames.Add("Id"); relation.ChildColumnNames.Add("ParentId"); radGridView1.Relations.Add(relation); this.radGridView1.UserAddedRow+=radGridView1_UserAddedRow; } private void radGridView1_UserAddedRow(object sender, GridViewRowEventArgs e) { e.Row.IsExpanded = true; this.radGridView1.CurrentRow = ((GridViewHierarchyRowInfo)e.Row).Views[0].TableAddNewRow; this.radGridView1.CurrentColumn = this.radGridView1.MasterTemplate.Templates[0].Columns[0]; this.radGridView1.BeginEdit(); }