VS.NET Intellisense Support for Exposing DataGridColumnCollection in a UserControl

Discussion in 'ASP .Net Building Controls' started by olliecwl, Apr 12, 2007.

  1. olliecwl

    olliecwl Guest

    Hi,

    I have a UserControl that contains an AJAX.NET UpdatePanel wrapped
    around a DataGrid. I'm exposing the datagrid's column collection as a
    public property of the UserControl. It looks something like this:

    [
    Browsable(true),
    PersistenceMode(PersistenceMode.InnerProperty),
    ]
    public DataGridColumnCollection Columns
    {
    get { return InnerGrid.Columns; }
    }

    When used on a page, the UserControl looks something like this:

    <my:CopyGrid ID="CopyTheseItems" runat="server">
    <Columns>
    <asp:TemplateColumn>
    <ItemTemplate><b><%# Container.DataItem %></b></ItemTemplate>
    </asp:TemplateColumn>
    </Columns>
    </my:CopyGrid>

    This functions as I'd hoped.

    The problem is in the building of the page. When creating the
    UserControl on a page, I get the option to add a Columns inner
    property tag. However, once inside that tag, I get NO Intellisense
    support for the various DataGridColumn objects. For whatever reason,
    it reverts back to the generic UI editor, giving me support for the
    creation of labels, textboxes, panels, etc.

    So after perusing the boards, I found and tried this:

    public class MyDataGridColumnCollectionEditor : CollectionEditor
    {
    public MyDataGridColumnCollectionEditor(Type type) : base(type) { }

    protected override Type CreateCollectionItemType()
    { return typeof(DataGridColumn); }

    protected override Type[] CreateNewItemTypes()
    {
    Type[] types = new Type[] { typeof(TemplateColumn),
    typeof(BoundColumn), typeof(ButtonColumn),
    typeof(DataGridColumn), typeof(HyperLinkColumn)
    };
    return types;
    }

    protected override object CreateInstance(Type itemType)
    {
    DataGridColumn column =
    itemType.GetConstructor(Type.EmptyTypes).Invoke(null) as
    DataGridColumn;
    return column;
    }
    }

    ......

    [
    Browsable(true),
    PersistenceMode(PersistenceMode.InnerProperty),
    EditorAttribute(typeof(MyDataGridColumnCollectionEditor),typeof(System.Drawing.Design.UITypeEditor)),
    ]
    public DataGridColumnCollection Columns
    { ... }

    No luck. I also took a look at (and considered revising) the .XSD
    files backing VS.NET, but that's a hornets' nest I'd rather avoid if I
    can.

    So... any thoughts? Like I wrote above, the UserControl works as I'd
    hoped; the problem I'm having is developing with it in an efficient
    and intuitive manner.

    Your thoughts are appreciated.

    best,
    jason
     
    olliecwl, Apr 12, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?S2FyaW5lIFByb290?=

    DataGridColumnCollection

    =?Utf-8?B?S2FyaW5lIFByb290?=, Jan 27, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    596
    =?Utf-8?B?S2FyaW5lIFByb290?=
    Jan 27, 2004
  2. =?Utf-8?B?Q2xhcmUgSHNpYW8=?=

    Can JavaScript intellisense in vs.net support DOM level1?

    =?Utf-8?B?Q2xhcmUgSHNpYW8=?=, Jun 1, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    418
    =?Utf-8?B?Q2xhcmUgSHNpYW8=?=
    Jun 1, 2004
  3. =?Utf-8?B?Y2xhcmUgaHNpYW8=?=

    Can JavaScript intellisense in vs.net support DOM level1?

    =?Utf-8?B?Y2xhcmUgaHNpYW8=?=, Jun 1, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    313
    =?Utf-8?B?Y2xhcmUgaHNpYW8=?=
    Jun 1, 2004
  4. =?Utf-8?B?RGFsZQ==?=

    Exposing UserControl in a MasterPage

    =?Utf-8?B?RGFsZQ==?=, Oct 2, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    374
    =?Utf-8?B?RGFsZQ==?=
    Oct 2, 2007
  5. Karine Proot

    DataGridColumnCollection.Add & Update

    Karine Proot, Jan 30, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    4
    Views:
    157
    Steven Cheng[MSFT]
    Feb 4, 2004
Loading...

Share This Page