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
475
HOw to check which parent is expanded
posted

Hi,

how to get the value of parent expanded.because by using that i have to set the textbox field to editable.suppose if the first parent is expanded then i have to make the textbox2 as editable else if the second parent is expanded then i have to set the textbox3 as editable.Here is the code am using

 

if (WebHierarchicalDataGrid2.GridView.Rows[0].HasRowIslands)

 {

 ContainerGrid childGrid = this.WebHierarchicalDataGrid2.GridView.Rows[0].RowIslands[0];

 for (int i = 0; i < childGrid.Rows.Count; i++)

 {

//Hiding the column

childGrid.Rows[i].Items[3].Column.Hidden = true;

}

//changing the readonly property to Textbox

 (childGrid.Rows[0].Items[2].FindControl("Band_TB2") as TextBox).ReadOnly = false;

 }

 else if (WebHierarchicalDataGrid2.GridView.Rows[1].HasRowIslands)

 {

ContainerGrid childGrid = this.WebHierarchicalDataGrid2.GridView.Rows[1].RowIslands[0];

for (int i = 0; i < childGrid.Rows.Count; i++)

 {

 //Hiding the column

 childGrid.Rows[i].Items[1].Column.Hidden = true;

}

//changing the readonly property to Textbox

 (childGrid.Rows[0].Items[2].FindControl("Band_TB3") as TextBox).ReadOnly = false;

 }

regards,

hsakarp.

  • 13438
    posted

    Hello Prakash,

    Please let me know if you have any further questions regarding this issue.

  • 13438
    Suggested Answer
    posted

    Hello Prakash,

    On which event you are trying to do this. If it is RowIslandsPopulating you can directly get it through e.Row.Items[i]. Otherwise as far as I can see you are getting the parent row with this.WebHierarchicalDataGrid2.GridView.Rows[0]. And its enough to add just “.Item[i]” in the end.