This is a migrated thread and some comments may be shown as answers.

master detail entity framework 4 poco class

4 Answers 71 Views
GridView
This is a migrated thread and some comments may be shown as answers.
marco
Top achievements
Rank 1
marco asked on 23 Dec 2010, 04:50 PM
Hi All
I using this code for generete gridview master detail  but not work
any ideas?
thancks a lot

GridViewTemplate

 

 

childTemplate = CreateChildTemplate();
GridViewRelation relation = new GridViewRelation(this.gwSchemi.MasterTemplate, childTemplate);relation.ChildColumnNames.Add("XMLFLUSSI");
this.gwSchemi.Relations.Add(relation);
this.gwSchemi.DataSource = ManagerSchema.GetSchemi();
this.gwSchemi.Refresh();

 

 

 

private GridViewTemplate CreateChildTemplate(){
GridViewTemplate template = new GridViewTemplate();
template.AutoSizeColumnsMode =
GridViewAutoSizeColumnsMode.Fill;
template.AllowDeleteRow =
false;
template.AllowEditRow =
false;
template.AllowAddNewRow =
false;
template.ReadOnly =
true;
GridViewTextBoxColumn idColumn = new GridViewTextBoxColumn("id");
ridViewTextBoxColumn nomerColumn = new GridViewTextBoxColumn("nome");
GridViewCheckBoxColumn statoColumn = new GridViewCheckBoxColumn("stato");
GridViewTextBoxColumn tipoColumn = new GridViewTextBoxColumn("tipo");
template.Columns.AddRange(idColumn,nomerColumn,statoColumn,tipoColumn);
template.Columns[
"id"].IsVisible = false;
return template;
}

this is the definition of the two poco class

 

 

 

public class XMLSCHEMI{
public Guid id { get; set; }
public string nome { get; set; }
public string XMLSCHEMA { get; set; }
public List<XMLFLUSSI> XMLFLUSSI { get; set; }
}

 

 

 

public class XMLFLUSSI{
public Guid id { get; set; }
public Guid id_xmlschemi { get; set; }
public string nome { get; set; }
public string f_origine { get; set; }
public string tab_destin { get; set; }
public Boolean stato { get; set; }
public string namepart { get; set; }
public Int32 length { get; set; }
public string extension { get; set; }
public string f_storico { get; set; }
public string f_errore { get; set; }
public string tipo { get; set; }
public XMLSCHEMI XMLSCHEMI { get; set; }
}

 

4 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 23 Dec 2010, 10:47 PM
Hi Marco,

Unfortunatly, I'm away now so don't have access to a development environment, however, at first glance it looks like you have missed declaring the ParentColumnName. (you have added the child column name but not the parent one)

I hope that helps
Richard
0
marco
Top achievements
Rank 1
answered on 24 Dec 2010, 10:09 AM
hi 
I used this tutorial for my code http://www.telerik.com/help/winforms/gridview-hierarchical-grid-object-relational-hierarchy-mode.html
and in mi ef schema XMLFLUSSI is navigation property.
I try to add parentcolum in reletion but not work.
Thancks for help
Marco
0
Emanuel Varga
Top achievements
Rank 1
answered on 26 Dec 2010, 08:14 PM
Hello Marco,

First of all, i cannot find the relation.ParentColumnNames.Add(....)
Second, are you sure you want to give a List as the ChildColumnNames property?

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga

Telerik WinForms MVP
0
marco
Top achievements
Rank 1
answered on 28 Dec 2010, 10:19 AM
Hi all
Thancks for reply i resolved, i misteke to using the correct parent and child column.
Hi
Marco
Tags
GridView
Asked by
marco
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
marco
Top achievements
Rank 1
Emanuel Varga
Top achievements
Rank 1
Share this question
or