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
263
WebGrid User Control (ASCX)
posted

I am creating a user control with ultrawebgrid..I have exposed few properties of webgird so that they show up in the properties window on the parent page..

 

Can anyone tell me how do I expose the columns collection in the property window?

 

Thanks

 

 

Parents
No Data
Reply
  • 19308
    posted

    Exposing the columns collection is the same as exposing any other property.  You would add a property to your UserControl which Gets the columns of the WebGrid. 

    There are some things you'll need to consider though.  Are you databinding the grid?  If so, you'll need to force a databind from inside of the columns property, or you'll end up working with the 'wrong' columns. 

    Also, be sure that the property you add to the user control only has a getter.  There's no reason to set the collection, you simply want to surface a reference to the grid's columns collection that's already there. 

    The biggest hurdle though, is getting the designer to persist any column property changes that you make.  This isn't something trivial at all, and I'm not even sure it's possible to do with a UserControl.  If you really need this design-time suppor, I'd recommend you extend from the base Infragistics WebGrid class, and create your own derived WebGrid, rather than going the UserControl route.

    -Tony

Children