"Invalid FORMATETC stucture" when dragging a custom Gridview onto

D

Dave

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.
 
A

Alessandro Zifiglio

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
 
A

Alessandro Zifiglio

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
 
D

Dave

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>
 
A

Alessandro Zifiglio

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top