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
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
Hi Tony..
Thanks for your response..I found out that it is not possible to expose column collection through the property windows eidtor..
In my ascx control I am using columns property below
{
}
On the aspx page that uses this ascx control
I want to be able to declatitively specify columns like below...But it wont let me do that..Any ideas on how can I get this done.?
<Columns>
<TemplatedColumn AllowResize="Free" BaseColumnName="FULL_NAME" HeaderClickAction="SortSingle"
Key="FULL_NAME" Width="180px">
<CellTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="AsgnDetails" ><%# Container.Text %></asp:LinkButton>
</CellTemplate>
<Header Caption="Name" ClickAction="SortSingle">
</Header>
<TemplatedColumn>
<UltraGridColumn BaseColumnName="HOME_COUNTRY_CITY" HeaderClickAction="SortSingle"
Key="HOME_COUNTRY_CITY" Width="200px">
<Header Caption="Home" ClickAction="SortSingle">
<RowLayoutColumnInfo OriginX="1" />
<Footer>
</Footer>
</UltraGridColumn>
</Columns>
Joel
Joel,
You're at the point where a UserControl is no longer a viable solution for what you're trying to accomplish. It will be a lot more work than it's worth. I would go the custom control route at this point.