Tuesday, October 30, 2018

Accessing accessing a child control within a custom usercontrol

Sorry in advance if this is a stupid one. I can't seem to figure out this detail and I'm guessing it's pretty basic.

I have a custom usercontrol that consists of a few controls, including a datagrid. Most of the time the data that gets populated in the grid, are just strings, but occasionally I need to apply formatting or suppress columns, so I need to be able to access the datagrid.

I've made a public property on the usercontrol that returns the gridcontrol. I was expecting it to work something like this:

<comp:MyControl>

<comp:MyControl.MyGrid>

<comp:MyControl.MyGrid.Columns>

....do something here

/comp:MyControl.MyGrid.Columns

/comp:MyGontrol.MyGrid

/comp:MyControl

But, it doesn't seem to work that way, or I'm missing a step. MyGrid is innaccessable. If anyone can set me on the correct path, it would be greatly appreciated. Thank you.

Accessing accessing a child control within a custom usercontrol Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team