Invalid postback or callback argument ASP.NET

I got this error

I got this error because I was using a ready made html5 template. The problem was duplicate form tag used multiple times in the template. Removing that get rid of the error. To be exact my duplicate form tag was in the master page which was a bit hard to find.

Read More

AP.NET misplaced tags can give you big headache

I was trying to add a new tab to the existing 2 tabs. I copied some 250 lines of code of the second tab, changed all IDS and ControlIDs for validation etc and finally made the code work. But only to find out that my tab3 would not appear, even though its heading did. I spend some time over this and tried to figure out what I am missing. After all I did not work with ASP.NET TABS before. Eventually found out that the contents of TAB3 were not showing because they were embedded one level below. I tried to…

Read More

It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level

Scott Michell wrote an excellent article about the above error explaining exactly why are you getting this error. Basically you are opening the parent folder of a project in Visual Studio and you get this error. Since web.config in this case is in sub folder, you get this error. A little Explanation There can be more than one web.conf files in your application. They can be all in root or in sub folders as in nested form. The root web.conf can contain almost all elements but that that are nested in sub folders may not contain certain elements. This error…

Read More

Accessing Local Resources in MVC

You want to localized your resource or in other words put them in a resource file in the local folder, how do you access it in MVC?   Here is how you will access it     public class Student     {       // Constuctor         public Student()         {             Name = MyStrings.name1;         }         public string Name { get; set; }     } A better way of doing it to put all resources in inside a separate folder and give them proper extension depending on where they will be used. For Example I can use >>LocalizedString >>>>>MyStrings.Resx >>>>>Mystrings.en-GB.Resx The program will automatically pick the right resource depending on the culture setting of the computer. In this…

Read More

Must declare the scalar variable “@ID”

Problem In an ASP.NET Application, you are using ListView, you are trying to delete a record. Update, Insert everything works fine but delete does not work. The SQL syntax is correct

You are using Eval or Bind with your parameter like this

Your ListView is declared like this

Error Message: The error is coming from SQL not ASP.NET Must declare the scalar variable “@ID”. You will find that although the error is coming from SQL but the cause is ASP.NET ListView. Why is this error? First of all it is interesting to knote that this error is…

Read More