"Invalid FORMATETC stucture" when dragging a custom Gridview onto

Discussion in 'ASP .Net Building Controls' started by Dave, Jul 19, 2006.

  1. Dave

    Dave Guest

    I created a simple custom control inherited from a GridView as a test...

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Web.UI.WebControls;

    namespace CustomControls
    {
    class CustomGridView : GridView
    {
    public string GetSomeValue()
    {
    return "Hello from custom control!";
    }
    }
    }

    The control appears in my toolbox of my web application but when I try to
    drag it onto my webform, I get the error message.
    Dave, Jul 19, 2006
    #1
    1. Advertising

  2. hi, start with making your class public, by default its private now you
    should be able to drag and drop it on your webform. By default, your class
    is declared 'internal' when an access modifier is not explicitly defined.
    Regards,
    Alessandro Zifiglio
    http://www.AsyncUI.net

    "Dave" <> ha scritto nel messaggio
    news:...
    >I created a simple custom control inherited from a GridView as a test...
    >
    > using System;
    > using System.Collections.Generic;
    > using System.Text;
    > using System.Web.UI.WebControls;
    >
    > namespace CustomControls
    > {
    > class CustomGridView : GridView
    > {
    > public string GetSomeValue()
    > {
    > return "Hello from custom control!";
    > }
    > }
    > }
    >
    > The control appears in my toolbox of my web application but when I try to
    > drag it onto my webform, I get the error message.
    >
    Alessandro Zifiglio, Jul 20, 2006
    #2
    1. Advertising

  3. oops, i have a typo in the statement i made earlier. i had said, by default
    the access modifier for a class is "private", i meant to say "internal".
    Apologies.
    Regards,
    Alessandro Zifiglio
    http://www.AsyncUI.net

    "Alessandro Zifiglio" <AlessandroZifiglio @ -h-o-t-m-a-i-l-c-o-m> ha scritto
    nel messaggio news:%...
    > hi, start with making your class public, by default its private now you
    > should be able to drag and drop it on your webform. By default, your class
    > is declared 'internal' when an access modifier is not explicitly defined.
    > Regards,
    > Alessandro Zifiglio
    > http://www.AsyncUI.net
    >
    > "Dave" <> ha scritto nel messaggio
    > news:...
    >>I created a simple custom control inherited from a GridView as a test...
    >>
    >> using System;
    >> using System.Collections.Generic;
    >> using System.Text;
    >> using System.Web.UI.WebControls;
    >>
    >> namespace CustomControls
    >> {
    >> class CustomGridView : GridView
    >> {
    >> public string GetSomeValue()
    >> {
    >> return "Hello from custom control!";
    >> }
    >> }
    >> }
    >>
    >> The control appears in my toolbox of my web application but when I try to
    >> drag it onto my webform, I get the error message.
    >>

    >
    >
    Alessandro Zifiglio, Jul 20, 2006
    #3
  4. Dave

    Dave Guest

    Re: "Invalid FORMATETC stucture" when dragging a custom Gridview o

    Alessandro,

    Thanks! that got me past the error. However, maybe you can help me with a
    new one.

    When I drag and drop the control, I now get "Error Creating Control Unknown
    server tag" in the designer. When I try to compile in VS I get:

    Element 'MyGridView' is not a known element. This can occur if there is a
    compilation error in the Web site.

    My code is:

    <%@ Register Assembly="CustomControls" Namespace="MyCustomControls"
    TagPrefix="cc1" %>

    <cc1:MyGridView id="MyGridView1" runat="server">
    </cc1:MyGridView>

    "Alessandro Zifiglio" wrote:

    > oops, i have a typo in the statement i made earlier. i had said, by default
    > the access modifier for a class is "private", i meant to say "internal".
    > Apologies.
    > Regards,
    > Alessandro Zifiglio
    > http://www.AsyncUI.net
    >
    > "Alessandro Zifiglio" <AlessandroZifiglio @ -h-o-t-m-a-i-l-c-o-m> ha scritto
    > nel messaggio news:%...
    > > hi, start with making your class public, by default its private now you
    > > should be able to drag and drop it on your webform. By default, your class
    > > is declared 'internal' when an access modifier is not explicitly defined.
    > > Regards,
    > > Alessandro Zifiglio
    > > http://www.AsyncUI.net
    > >
    > > "Dave" <> ha scritto nel messaggio
    > > news:...
    > >>I created a simple custom control inherited from a GridView as a test...
    > >>
    > >> using System;
    > >> using System.Collections.Generic;
    > >> using System.Text;
    > >> using System.Web.UI.WebControls;
    > >>
    > >> namespace CustomControls
    > >> {
    > >> class CustomGridView : GridView
    > >> {
    > >> public string GetSomeValue()
    > >> {
    > >> return "Hello from custom control!";
    > >> }
    > >> }
    > >> }
    > >>
    > >> The control appears in my toolbox of my web application but when I try to
    > >> drag it onto my webform, I get the error message.
    > >>

    > >
    > >

    >
    >
    >
    Dave, Jul 20, 2006
    #4
  5. Re: "Invalid FORMATETC stucture" when dragging a custom Gridview o

    Dave, for me, it works well in the designer when i drag and drop =P
    The same code you pasted, after changing the access modifier to public, that
    is :)

    So, i dont know what you did to get this error. From the vs.net menu Try to
    do a build - clean solution in the solution that is hosting your custom
    control. And with your custom control as the active project got to the menu
    again and this time do a build - clean "your custom control project". Try
    rebuilding the project, go back to your solution hosting the control and
    drag and drop it from the toolbox, hoping that this might have fixed it.
    Donno what else to suggest since your code example works well for me =P

    Regards,
    Alessandro Zifiglio
    http://www.AsyncUI.net

    "Dave" <> ha scritto nel messaggio
    news:...
    > Alessandro,
    >
    > Thanks! that got me past the error. However, maybe you can help me with a
    > new one.
    >
    > When I drag and drop the control, I now get "Error Creating Control
    > Unknown
    > server tag" in the designer. When I try to compile in VS I get:
    >
    > Element 'MyGridView' is not a known element. This can occur if there is a
    > compilation error in the Web site.
    >
    > My code is:
    >
    > <%@ Register Assembly="CustomControls" Namespace="MyCustomControls"
    > TagPrefix="cc1" %>
    >
    > <cc1:MyGridView id="MyGridView1" runat="server">
    > </cc1:MyGridView>
    >
    > "Alessandro Zifiglio" wrote:
    >
    >> oops, i have a typo in the statement i made earlier. i had said, by
    >> default
    >> the access modifier for a class is "private", i meant to say "internal".
    >> Apologies.
    >> Regards,
    >> Alessandro Zifiglio
    >> http://www.AsyncUI.net
    >>
    >> "Alessandro Zifiglio" <AlessandroZifiglio @ -h-o-t-m-a-i-l-c-o-m> ha
    >> scritto
    >> nel messaggio news:%...
    >> > hi, start with making your class public, by default its private now you
    >> > should be able to drag and drop it on your webform. By default, your
    >> > class
    >> > is declared 'internal' when an access modifier is not explicitly
    >> > defined.
    >> > Regards,
    >> > Alessandro Zifiglio
    >> > http://www.AsyncUI.net
    >> >
    >> > "Dave" <> ha scritto nel messaggio
    >> > news:...
    >> >>I created a simple custom control inherited from a GridView as a
    >> >>test...
    >> >>
    >> >> using System;
    >> >> using System.Collections.Generic;
    >> >> using System.Text;
    >> >> using System.Web.UI.WebControls;
    >> >>
    >> >> namespace CustomControls
    >> >> {
    >> >> class CustomGridView : GridView
    >> >> {
    >> >> public string GetSomeValue()
    >> >> {
    >> >> return "Hello from custom control!";
    >> >> }
    >> >> }
    >> >> }
    >> >>
    >> >> The control appears in my toolbox of my web application but when I try
    >> >> to
    >> >> drag it onto my webform, I get the error message.
    >> >>
    >> >
    >> >

    >>
    >>
    >>
    Alessandro Zifiglio, Jul 20, 2006
    #5
    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. Dave
    Replies:
    0
    Views:
    468
  2. =?Utf-8?B?QW1v?=

    Dragging selected item from a listbox onto a table

    =?Utf-8?B?QW1v?=, Jul 9, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    371
    =?Utf-8?B?QW1v?=
    Jul 9, 2006
  3. Mark Sisson

    Cannot drag a new Custom Control onto Designer

    Mark Sisson, Jul 13, 2003, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    147
    Mark Sisson
    Jul 13, 2003
  4. Mark Sisson

    Cannot drag a new Custom Control onto the Designer

    Mark Sisson, Jul 16, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    166
    Mark Sisson
    Jul 16, 2003
  5. Jessica Hart
    Replies:
    0
    Views:
    92
    Jessica Hart
    Oct 1, 2003
Loading...

Share This Page