The operation could not be completed. Invalid FORMATETC structure - asp.net

I am developing web based application using asp.net and ajax. Today I am facing an issue, while dragging and dropping the ajax based components under the ajax enabled webform.
The error message is
The operation could not be completed. Invalid FORMATETC structure
If your answer is assembly then please let me know which assembly such issues (be specific about assemblies)

It is basically due to Ajax Toolkit assembly if you have added it as toolbox. Only way to get rid of this is to restart your IDE , whenever your have Formatetc error , or unload the toolbox and recreate it. Either of them will solve the. But it will not go. Occurance will become rare. Hope this help.
Ajax toolkit version < 3.5 seen such bugs.

If you using AjaxControlToolkit.dll try remove it and redownload and adding again.
Also try re-install Ajax Control Toolkit, which might solve your problem.

first Check in control panel => administrative tool => .net framework . your internet priority is low then change it

Related

MessageBox.Show() not working in ASP.NET

I am trying to display some text using MessageBox.Show as shown below in a page_load event in ASP.NET. Before anyone jumps on the case why I am using it in ASP.NET, the use is for debugging only on my own dev box for a special need. There's a reference to System.Windows.Forms in the app.
I used it a few years ago so I know WinForm's MessageBox works. I am using .NET 4.0 and VS 2010. I don't think anything related to this function has changed.
MessageBox.Show("Message", "Caption", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); //used also ServiceNotification option
Any ideas why the message box doesn't display? I have only that line in the code.
ADDITION:
I am VERY AWARE of the message box thing implications. It's a temporary thing for debugging only. The line won't go into production. I have no access to javascript. Please put your thought into why it doesn't work instead of why I shouldn't be using it. I have used it before in 2.0 and it does work. I want to know if the newer .NET changed anything or I misused the option.
Direct Answer: it works in Visual Studio's web server , not in IIS.
The web application is hosted in a process that does not have a desktop, so you cant see any messageboxes.
#Tony, if you add System.Winform.dll to your rference, then you will be able to call message box.show at you development machine. But when you deploy it to some live server it will not work. So alternatively, you need to use javascript alerts. For this you can use this
private void ShowMessage(string message)
{
ScriptManager.RegisterClientScriptBlock(control, GetType(),"key","string.format("alert('{0}');",message),true);
}
Back in .Net 2.0 days, you could do this by including system.windows (I think) in your using statement.
Then, in the method, it would be system.windows.forms.Messagebox.show("foo");
I won't presume to tell you "yer doin it wrong"...
Just be aware that this will only show up on the server box, and could cause issues in a production environment.
The alert() is better, and console.log() is even better.

Why can't I debug/step-into FormsAuthentication.Authenticate?

I am having some trouble with active directory authentication using FormsAuthentication in ASP.NET MVC 2 (VS 2010).
As I understand it I should be able to step into/through the Microsoft source code for FormsAuthentication.Authenticate if I check 'Enable source server support' and 'Enable .Net Framework source stepping' in Options->Debug->General and specify 'Microsoft Symbol Servers' in Options->Debug->Symbols.
I have done this and can step into a whole bunch of MS source code, but not FormsAuthentication.Authenticate. The debugger simple steps over it.
Can anyone tell me why this is? If I could step into FormsAuthentication.Authenticate it would make my life a whole lot easier.
Thanks.
Ok, my stupid.
I should have been using Membership.ValidateUser NOT FormsAuthentication.Authenticate.
My problems are all solved :)
However, I never figured out why I could not step into FormsAuthentication.Authenticate. I guess it will remain a mystery...

ASP.Net Ajax $common.parseUnit function

Im trying to adapt some code that I have found online that uses this function..
$common.parseUnit
Does anyone know where it lives as at present I am getting an "$common.parseUnit is undefined" error when the code hits that line.
Thanks.
$common.parseUnit() is exposed by the common scripts of the ASP.NET AJAX Control Toolkit, so you probably need to install that toolkit.
EDIT: If you have the toolkit installed, check if you have properly referenced the common toolkit scripts, either by decorating your extender classes with:
[RequiredScript(typeof(CommonToolkitScripts))]
Or by explicitly adding the reference to your ToolkitScriptManager:
yourToolkitScriptManager.Scripts.Add(new ScriptReference("Common.Common.js",
"AjaxControlToolkit"));

ASP.NET WebControls are not appearing in my VS 2008 toolbox

It's been a while since I've created a new ASP.NET web application. (I've been doing ASP.NET MVC for the last 9 months, and hadn't done an ASP.NET site for about a year before that.) Now I've created a new regular ASP.NET app and when I look at the Default.aspx file, Visual Studio is only displaying the HTML tab in the Toolbox. I don't have the WebControls or the data access controls. (I don't even remember what other tabs I should be seeing.)
When I try to add a web control manually like this,
<asp:Label id="LabelTest" runat="server"></asp:Label>
I get a green squiggly and the tool tip says Unrecognized namespace 'asp'.
What do I need to do to get the Web Controls in my toolbox and also get the namespace to be recognized?
I've got this line in my page load event:
LabelTest.Text = "testing"
My app compiles and runs as expected -- the label displays testing.
So, I could word around it, but this will just make designing the forms more difficult.
Update: I've tried all 3 of the suggestions posted as answers so far and nothing has helped. Now I'm seeing a different error in addition to what I was getting before. In the designer I now see this:
Error Creating Control - LabelTest
Could not load file or assembly 'Microsoft.Web.Authoring' or one of its dependencies. The system cannot find the file specified.
Have you tried repairing the Visual Studio installation?
Pops-in the disc and select "Repair"?
If that doesn't work, then I think you should just re-install Visual Studio... It seems like a plugins/add-on corrupted the toolbox
Have you tried
removing and then re-adding the assembly references and then
rebuilding the solution?
Have you tried the "Reset Toolbox" command?
reset toolbox http://chakrit.net/files/stackoverflow/so_reset_toolbox.png
...

Why is this code stopping? VB ASP.NET

Hey I am coding using Visual Studio 2003. My program worked fine until I introduced a dll I made using CreateObject.
Code:
Set docs2 = server.CreateObject("DocGetter.Form1")
docs2.GetDocument oXMLDom,numID
It appears to be getting stuck at this code. I've already used regasm to register the dll.
What else could be wrong?
Add a reference to the dll in your project and instantiate the object like this:
Dim docs2 As New DocGetter.Form1()
If that doesn't make sense, then fix it so it does. There's no good reason to use CreateObject in .Net code. (Okay, that's hyperbole. But the principal is sound).
Can you clarify - is this a web app or a client (winform) app? Form1 sounds like a winform. ASP.NET runs at the server, so showing a form would be inappropriate - it would happen at the server, not the client. In short, don't do this!
I also can't see where "stored procedures" figures in this, so I've removed the tag.
What are you trying to do? Options for showing something more complex at the client include:
dhtml
flash
silverlight
clickonce [requires windows client]
ocx [not recommended]
I'd bet money that this function isn't defined with this name and/or parameters.
docs2.GetDocument oXMLDom,numID
But because of the way you're instantiating the object, the compiler has no way of knowing this... I think.

Resources