Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
175
Hidden property for column in child row doesn't work ( Hierarchical ultrawingrid , ultragrid, wingrid )
posted

It looks like the hidden propery deosn't work in the Hierarchical ultraGrid for the child rows.

I create a simple form with one UltraGrid in it and I manually put 2 bands in it and in the page load I put the code below.

 private void HiddenColumns_Load(object sender, EventArgs e)

{ 

 

 

//======================================

//step 1: ultrawingrid structure

ultraGrid1.DisplayLayout.Bands[0].Columns.Add("Primary");

ultraGrid1.DisplayLayout.Bands[0].Columns.Add(

"parentcol");

ultraGrid1.DisplayLayout.Bands[0].Columns.Add(

"parenthidden");

ultraGrid1.DisplayLayout.Bands[0].Columns[

"parenthidden"].Hidden = true;

ultraGrid1.DisplayLayout.Bands[1].Columns.Add(

"Foreign");

ultraGrid1.DisplayLayout.Bands[1].Columns.Add(

"ChildPrimary");

ultraGrid1.DisplayLayout.Bands[1].Columns.Add(

"childhidden");

ultraGrid1.DisplayLayout.Bands[1].Columns[

"childhidden"].Hidden= true;

 

 

 

 

 

 

 

 //======================================

 

 

//step 2: Dataset structure

 DataSet ds = new DataSet();

ds.Tables.Add(

"Parent");

ds.Tables.Add(

"Child");

ds.Tables[

"Parent"].Columns.Add("Primary");

ds.Tables[

"Parent"].Columns.Add("parentcol");

ds.Tables[

"Parent"].Columns.Add("parenthidden");

ds.Tables[

"Child"].Columns.Add("Foreign");

ds.Tables[

"Child"].Columns.Add("ChildPrimary");

ds.Tables[

"Child"].Columns.Add("childhidden");

ds.Tables[

"Parent"].PrimaryKey = new DataColumn[] { ds.Tables["Parent"].Columns["Primary"] };

ds.Tables[

"Child"].PrimaryKey = new DataColumn[] { ds.Tables["Child"].Columns["ChildPrimary"] };

ds.Relations.Add(

"relation",ds.Tables["Parent"].Columns["Primary"],ds.Tables["Child"].Columns["Foreign"]);

 

//======================================

 

 

 

 

 

 

 

 

 

 

 

 

 

 

//step 3: adding rows to the dataset

 DataRow rowParent = ds.Tables["Parent"].NewRow();

rowParent[

"Primary"] = 1;

rowParent[

"parentcol"] = "Hello!!!";

rowParent[

"parenthidden"] = "I am hidden in parent";

ds.Tables[

"Parent"].Rows.InsertAt(rowParent, 0);

 

DataRow rowrChild = ds.Tables["Child"].NewRow();

rowrChild[

"Foreign"] = 1;

rowrChild[

"ChildPrimary"] = 101;

rowrChild[

"childhidden"] = "I am hidden in child";

ds.Tables[

"Child"].Rows.InsertAt(rowrChild, 0);

 

//======================================

 

 

 

 

 

 

 

 

 

 

 

 

//step 4: binding the dataset to the grid

ultraGrid1.DataSource = ds;

}

 

this is the result I was expecting the childhidden to be hidden just like the parenthidden that's hidden in the parent row.

 please I am stuck with this problem, I need and explanation.

thanks for all your help in advance.

D

 

 

Parents
  • 175
    posted

    the code was formated automatically when I posted so here is a better version of it.

    private void HiddenColumns_Load(object sender, EventArgs e)

            {

                //======================================

                //step 1: ultrawingrid structure

                ultraGrid1.DisplayLayout.Bands[0].Columns.Add("Primary");

                ultraGrid1.DisplayLayout.Bands[0].Columns.Add("parentcol");

                ultraGrid1.DisplayLayout.Bands[0].Columns.Add("parenthidden");

                ultraGrid1.DisplayLayout.Bands[0].Columns["parenthidden"].Hidden = true;

     

                ultraGrid1.DisplayLayout.Bands[1].Columns.Add("Foreign");

                ultraGrid1.DisplayLayout.Bands[1].Columns.Add("ChildPrimary");

                ultraGrid1.DisplayLayout.Bands[1].Columns.Add("childhidden");

                ultraGrid1.DisplayLayout.Bands[1].Columns["childhidden"].Hidden= true;

     

                //======================================

                //step 2: Dataset structure

                DataSet ds = new DataSet();

                ds.Tables.Add("Parent");

                ds.Tables.Add("Child");

     

                ds.Tables["Parent"].Columns.Add("Primary");

                ds.Tables["Parent"].Columns.Add("parentcol");

                ds.Tables["Parent"].Columns.Add("parenthidden");

     

                ds.Tables["Child"].Columns.Add("Foreign");

                ds.Tables["Child"].Columns.Add("ChildPrimary");

                ds.Tables["Child"].Columns.Add("childhidden");

     

                ds.Tables["Parent"].PrimaryKey = new DataColumn[] { ds.Tables["Parent"].Columns["Primary"] };

                ds.Tables["Child"].PrimaryKey = new DataColumn[] { ds.Tables["Child"].Columns["ChildPrimary"] };

     

                ds.Relations.Add("relation",

                        ds.Tables["Parent"].Columns["Primary"],

                        ds.Tables["Child"].Columns["Foreign"]);

     

                //======================================

                //step 3: adding rows to the dataset

                DataRow rowParent = ds.Tables["Parent"].NewRow();

                rowParent["Primary"] = 1;

                rowParent["parentcol"] = "Hello!!!";

                rowParent["parenthidden"] = "I am hidden in parent";

                ds.Tables["Parent"].Rows.InsertAt(rowParent, 0);

     

                DataRow rowrChild = ds.Tables["Child"].NewRow();

                rowrChild["Foreign"] = 1;

                rowrChild["ChildPrimary"] = 101;

                rowrChild["childhidden"] = "I am hidden in child";

                ds.Tables["Child"].Rows.InsertAt(rowrChild, 0);

     

     

                //======================================

                //step 4: binding the dataset to the grid

                ultraGrid1.DataSource = ds;

     

            }

     

Reply Children