Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Building Controls / July 2006

Tip: Looking for answers? Try searching our database.

"Invalid FORMATETC stucture" when dragging a custom Gridview onto

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave - 19 Jul 2006 21:29 GMT
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 - 20 Jul 2006 14:36 GMT
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

>I created a simple custom control inherited from a GridView as a test...
>
[quoted text clipped - 16 lines]
> 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 - 20 Jul 2006 14:48 GMT
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

> 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
[quoted text clipped - 23 lines]
>> 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 - 20 Jul 2006 17:28 GMT
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>

> 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".
[quoted text clipped - 30 lines]
> >> 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 - 20 Jul 2006 20:07 GMT
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

> Alessandro,
>
[quoted text clipped - 55 lines]
>> >> to
>> >> drag it onto my webform, I get the error message.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.